MSQ Questions From Each Subject
MSQ Questions From Each Subject
Q1:
If L is a regular language over alphabet {a,b}, let L’ be the set of strings
in L that are palindromes.
Which of the following statement is false ?
A. L’ can never be regular.
B. L’ is always regular.
C. If L is infinite regular language then L’ is Never regular.
D. If L is set of all strings over the given alphabet then L’ is non-
regular.
Answer : A,B,C
Explanation : If L is finite then L’ is also finite so L’ can be regular. So,
option A is false. If L is set of all strings over the given alphabet then L’
is non-regular. So option B is false. Option D is true. Option C is false
for the language a*.
Compiler Design :
Q2:
Choose the False statements about the above grammar and language :
A. The given grammar is ambiguous.
B. “and” has higher precedence than “or”
C. “or” has higher precedence than “and”
D. “or”, “and” are left associative, But not right associative
Answer : B,C,D
Explanation : “or, and” are both left and right associative and have
equal precedence. The grammar is ambiguous because “p or q or r” has
more than one parse trees.
C and DS :
Q3:
push (x)
A[pos] ← x
pos ← pos + 1
end push
pop ( )
pos ← pos - 1
return A[pos]
end pop
A. Replacing the code for Push with that for Pop and vice versa
D. None
Answer : B,C
Explanation :
I. Replacing the code for Push with that for Pop and vice versa
This is false because push and pop will work opposite of what they
should do. Push will do popping and pop will do pushing.
III. Reversing the order of the statements in both Push and Pop
Disc Maths :
Q4:
Let G = (V,E ) be a finite directed acyclic graph with |E| > 0. Which of
the following must be true?
A. G has a vertex with no incoming edge.
B. G has a vertex with no outgoing edge.
C. G has an isolated vertex, that is, one with neither an incoming edge
nor an outgoing edge.
D. None
Answer : A,B
Explanation : Since graph is finite directed acyclic graph so there must
be some vertex with no incoming edge and there must be some vertex
with no outgoing edge. C is not necessarily true.
CO :
Q5:
Which of the following statements about caches is (are) true?
A. A direct-mapped cache can have a lower miss rate than an associative cache of the same
size (number of blocks).
B. Programs with high spatial locality have a low cache miss rate primarily because the exact
same addresses are re-referenced.
C. Programs with high temporal locality have a low cache miss rate primarily because the exact
same addresses are re-referenced.
D. None
Answer : A,C
Explanation :
Direct-mapped cache may have lower miss rate than an associative
cache of the same size (number of blocks) because in case of
associative cache, page replacement depends on the page replacement
algorithm, But in case of direct mapped cache, page replacement
algorithms are Not used.
So, consider there are four cache lines, and the following reference
string( requested block numbers of main memory) : 0,1,2,3,4,3,4,3,4,3 ..
Algo :
Q6:
Mergesort works by splitting a list of n numbers in half, sorting each
half recursively, and merging the two halves.
Which of the following data structures will allow mergesort to work in
On O(nlogn) time?
A. A singly linked list
B. A doubly linked list
C. An unsorted array
D. A sorted array
Answer : A,B,C,D
Explanation :
Using array, sorted or unsorted, we already know that merge sort
works in nlogn time. Using linked list also it will work in nlogn time. In
linked list we will do these things in merge sort :
1. Finding middle of the list (O(n) time)
2. Sorting both halves (2T(n/2) times)
3. Merging the two sorted halves (O(n) time)
D. None
Answer : A,C
Explanation :
In Serializable schedules (Conflict Serializable), We DO NOT have lost update problem
because when there is lost update problem, there will be cycle in the precedence graph,
So Not Conflict serializable.