Consider two sets A = {2,4,5,6,7} and B = {10,11,12,13,14}. Two numbers are selected randomly, one from each set. What is the probability that the difference of two numbers will be 9?
0.20
0.12
0.18
0.16
Correct Answer
Option 2
Solution
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Find the missing number.
54
63
76
12
?
30
42
12
46
51
48
24
54
Correct Answer
Option 1
Solution
Second row element = First row element - Third row element
54 - 42 = 12
76 - 46 = 30
63 - 12 = 51
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The total revenue of a company during 2015-2019 is shown in the below bar graph. If the total expenditure of the company in each year is 400 million rupees, then the aggregate profit of loss (in percentage) on the total expenditure of the company during 2015-2019 is (2MARKS)
25% loss
50% profit
50% loss
16.67% profit
Correct Answer
Option 2
Solution
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Two trains start from the station A and B and travel towards each other at speeds of 36 km/hr and 48 km/hr respectively. At the time of their meeting, the second train had travelled 72 km more than the first. The distance between A and B is:
620 km
550 km
600 km
504 km
Correct Answer
Option 4
Solution
The second train has travelled 72 km more than the first train because the speed of the second train is 12 km/hr more than the first.
Time taken by second train to cover 72 km with surplus 12 km/hr = 72/12 = 6 hours
Then the time taken by both trains before meeting is 6 hours.
So, relative speed = 36 + 48 = 84
Total distance covered by both trains = 84 × 6 = 504 km
Distance between A & B = 504 km
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The given question consists followed by three statements. Read the question and decide which of the statements necessary to answer the question.
Question: What is M’s share of profit in a joint venture?
Statements:
(I) L started a business investing Rs 80,000.
(II) M joined him after 3 months.
(III) K joined after 4 months with a capital of Rs.1,20,000 and got Rs.6000 as his share profit.
All I, II, III
I and III only
II and III only
Data inadequate
Correct Answer
Option 4
Solution
From I, II, III, we get
K : L : M = (120000×8) : (80000×12) : (X*9)
Since M’s investment is not given, the above ratio cannot be given.
∴ Data adequate.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Find the missing term in the sequence
5, 11, 17, ?, 31, 41
19
21
23
25
Correct Answer
Option 3
Solution
All the numbers in the series are alternative prime numbers. So the missing term is 23.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Fill in the blanks with the suitable word.
Moses was watching the rain rattle the window ____
plane
pane
plain
pain
Correct Answer
Option 2
Solution
The words 'pain' and 'pane' 'plain' and 'plane' are homophones: they sound alike but have different meanings. Therefore you need to understand the context of the sentence to use the write word.
The above sentence is in relation with rain hitting against a window pane. Pane refers to the glass sheet of a window.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Tyrant: Ruler :: Disciplinarian : ?
Teacher
Driver
Policy maker
Servant
Correct Answer
Option 1
Solution
The relationship here is about the character of the person and the person.
The word tyrant means a cruel or oppressive Ruler.
Therefore the character disciplinarian best suits teacher in the options given.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Find the odd one out.
Banquet, Carnival, Ravenous, Merry -making.
Merry -making
Ravenous
Carnival
Banquet
Correct Answer
Option 2
Solution
The words Banquet, Carnival and Merry - making are synonyms of Feast. Whereas the word Ravenous means hunger for food. Therefore Ravenous is the odd word here.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Read the passage and answer the question below.
PASSAGE
Serotonin is a neurotransmitter that gets the most attention. It is derived from the protein that is amino acid tryptophan and belongs to the inhibitor group of relaxing neurotransmitters that gives in a sense of happiness and stabilizes one’s mood. In case you feel irritated, reprieved, depression, have insomnia or low-self esteem, you might want to give your serotonin levels a boost to improve your overall well being. Serotonin also works as a natural appetite suppressant and its deficiency is closely related to obesity or weight gain. Also, when we have low serotonin levels, we start getting carbohydrate or sugar cravings because tryptophan - the building block from which serotonin is derived, can only get into our brain after we eat sweet or starchy foods. So, the next time you get a sugar or carb craving, observe how you are feeling, as any cravings are closely related to mood.
Let’s look at things that we can do to improve serotonin levels in our brain.
Always have a balanced diet of carbohydrates and proteins in your meal to synthesize serotonin properly because your need to have enough tryptophan in the blood to improve serotonin.
Sunlight from 10am - 3pm is one of the best sources of natural vitamin D, which plays a key role in the synthesis of serotonin.
Sleep is an important factor to improve our health. The lack of it disrupts nerve function as well as optimal neurotransmission of serotonin. To reverse the disruption in the brain's serotonin system, you need to get proper undisturbed sleep to go through proper detoxification and recovery processes.
Exercise regularly to improve blood circulation and to release the feel-good hormone - endorphins. It is believed that exercise also increases the availability of tryptophan in our body, which is converted to serotonin.
Question:
Name the feel-good hormone.
Tryptophan
Serotonin
Oxytocin
Endorphin
Correct Answer
Option 4
Solution
In the passage it is given ‘Exercise regularly to improve blood circulation and to release the feel-good hormone - endorphins.’
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following tree
If the post order traversal gives pq-rs*+ then the label of the nodes 1,2,3,… will be?
+,-,*,p,q,r,s
p,-,q,+,r,*,s
p,q,r,s,-,*,+
-,p,q,+,*,r,s
Correct Answer
Option 1
Solution
Postorder traversal of the given binary tree will give the following sequence: 4 5 2 6 7 3 1.
Now comparing the sequence with p q – r s * + we get 1 = +, 2 = -, 3 = *, 4 = p, 5 = q, 6 = r and 7 = s.
So, option (A) is correct.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
What is the output of the following program?
#include <stdio.h>
#define x 3+2
int main()
{
int i;
i = x*x*x;
printf("%d",i);
return 0;
}
125
11
17
27
Correct Answer
Option 3
Solution
The C preprocessor will literally substitute all instances of x for 4+1, resulting in the following code:
i = 3+2*3+2*3+2;
Since * has precedence over +, this evaluates to:
i = 3+6+6+2;
and i gets the 17 value .
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
What is the maximum height of an AVL tree with 9 nodes ? Assume the height of the tree with a single node is 0.
4
5
3
6
Correct Answer
Option 3
Solution
We try to keep the tree balanced and increase height as much possible in each iteration.
Max height = 3
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time on Depth First Search of G? Assume that the graph is represented using an adjacency matrix. n is number of nodes m is number of edges.
O(n)
O(n + m)
O(n^2 )
O(nm)
Correct Answer
Option 3
Solution
In adjacency matrix, dimension is nn.
To find all neighbours we need O(n) operations.
∴ Tight bound = O(n^2)
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
If the DFS finishing time f[u] < f[v] for two vertices u and v in a directed graph G, and u and v are in the same DFS tree in the DFS forest, then u is an ancestor of v in the depth first tree
True
False
None
Correct Answer
Option 2
Solution
f(b) < f(c), but b is not ancestor of c.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The in-order traversal of some binary tree produced the sequence HFIEJGZ, and the post-order traversal of the same tree produced the sequence HIFJZGE. What will be the total number of nodes in the left subtree of the given tree?
2
3
4
None
Correct Answer
Option 2
Solution
Last value in post order is root.
∴ E is root.
All values before E in preorder would be in left subtree.
H, F, I will be in left subtree.
∴ Answer: 3
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
(A) Every graph has a unique minimum spanning tree .
(B) A graph may have more than one minimum spanning tree .
(C) A graph with distinct weights has a unique minimum spanning tree .
(D) A graph with distinct weights may have more than one minimum span-
ning tree .
The correct answers among the above are
A,C
B,C
A,B
B,D
Correct Answer
Option 2
Solution
The correct options are correct statements!
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
What us the output of following C program? (1 mark)
#include <stdio.h>
int main() {
int a=10;
int b=5;
a=a^b;
b=a^b;
a=a^b;
printf("%d %d",a,b);
return 0;
}
5 10
15 5
50 2
10 5
Correct Answer
Option 1
Solution
The bitwise XOR operator can be used to swap two variables. The XOR of two numbers x and y returns a number which has all the bits as 1 wherever bits of x and y differ. For example XOR of 10 (In Binary 1010) and 5 (In Binary 0101) is 1111 and XOR of 7 (0111) and 5 (0101) is (0010).
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Find the total profit in the following 0/1 knapsack problem. Weight of the knapsack is 5 units.
[ Note: Assume unlimited number of items is allowed ]
Weights
2
3
1
5
Profits
64
81
30
25
158
Correct Answer
Option 1
Solution
Let P(w) is the maximum profit obtained with weight w.
P(0) = 0
P(1) =30 (Item 3)
P(2)=Max(64+P(0),30+P(1) )
=Max(64,60)
=64(Item 1)
P(3)=Max(81+P(0),64+P(1),30+P(2) )
=Max(81+0,64+30,30+64)
=Max(81,94,94)
=94(Item 1,3)
P(4)=Max(64+P(2),81+P(1),30+P(3) )
=Max(64+64,81+30,30+94)
=Max(128,111,124)
=128(2 number of Item 1's)
P(5)=Max(64+P(3),81+P(2),30+P(4),25)
=Max(64+94,81+64,30+128,25)
=Max(158,145,158,25)
=158(2 number of item 1 &1 number of item 3)
So,total profit is 158.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Which of the following is/are FALSE [ MSQ ]
Multiplying all edge weights by a positive number might change the graph’s minimum spanning tree
A graph can have more than one shortest path between two vertices
A graph where all edge weights are distinct can have more than one shortest path between two vertices is unique
Inserting an element into a binary search tree of size n always takes O(log n) time.
Correct Answer
Option 1,3,4
Solution
FALSE: Multiplying all edge weights by a positive number does not change the graph’s minimum spanning tree.
TRUE: A graph can have more than one shortest path between two vertices
FALSE: A graph where all edge weights are distinct can have more than one shortest path between two vertices.
Even if no two edges have the same weight, there could be two paths with the same weight. For example, there could be two paths from s to t with lengths 3 + 5 = 8 and 2 + 6 = 8. These paths have the same length (8) even though the edges (2, 3, 5, 6) are all distinct.
FALSE: Inserting an element into a binary search tree takes O(h) time, where h is the height of the tree. If the tree is not balanced, h may be much larger than log n (as large as n − 1).
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Let T(n)=T(n-1)+2n for n > 1 and T(1)=1. Then T(n) is ________?
O(n*2^n)
O(2^n)
O(3^n * n^2)
None of the above
Correct Answer
Option 2
Solution
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
List of keys (K) = 6, 17, 23, 34, 48, 99 are inserted into the hash table by using hash function H=Kmod10. For resolving collisions linear probing is used. Number of collisions occurred when we insert new elements ‘103’ and ’33’ respectively.
2 and 7
3 and 6
4 and 5
1 and 6
Correct Answer
Option 1
Solution
Initially table is
When we try to insert 103, it should be put at slot 3(since 103 mod 10 = 3). Since already 23 are present at slot 3 we will move to the next slot and in the next slot also 34 is present. So, we will put 103 at slot 5. Therefore the number of collisions after inserting 103 is 2.
Final hash table is
Now when we try to insert 33, collisions will happen between 33 and 23, 34, 103, 6, 7, 48, 19. So, finally it will be placed at slot 0.
Here the number of collisions after inserting 33 is 7.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider a modification of the insertion sort algorithm, which performs a binary search instead of sequential to find the position where the element to be inserted in each pass of the algorithm. What is the worst case running time of this algorithm?
O(n)
O(nlogn)
O(n^2)
None of these
Correct Answer
Option 3
Solution
TotalIn insertion sort the worst case passes are (n-1). So, asymptotically O(n).
In each pass we need to find the search time and move (or) shift the elements of an array.
= Search time + Moving or shifting the elements of an array
= O(logn)+O(n)
= O( Time complexity = Total number of passes * Each pass time.
= O(n)*O(n)
= O(n^2)
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following sort function
Bob(Array[1...n], n)
{
for(i=1; i<n; i++)
{
k=i;
for(j=i+1; j<=n; j++)
{
if(Array[j] < Array[k])
k=j;
}
if(k! = i)
swap(Array[i], Array[k]);
}
}
How many minimum numbers of swaps are possible for best case using the above Bob() function with an array of n elements?
O(1)
O(logn)
O(n)
O(n^2)
Correct Answer
Option 1
Solution
The given Bob() function is a variant of selection sort.
If all elements are already in sorted order, then the condition k!=i always falls and no swap will be performed.
There are zero swaps in the best case of the above Bob()function.
O(1) swaps are the best case.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Select the correct option. [MSQ]
Finite automata has infinite memory.
Finite automata has finite memory.
Any Moore machine has an equivalent Mealy machine.
We can also convert regular grammar into chomsky normal form.
Correct Answer
Option 2,3,4
Solution
Finite automata has finite memory, actually FSM memory is limited by its number of states. Every Moore machine can be converted into corresponding Mealy machine. Every regular grammar is also CFG and hence we can convert it into CNF. But the resulting grammar will not be regular.
For example: Consider a regular grammar
S-> aS | a
The corresponding CFG in CNF form will be
S-> SA |a
A->a
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider a Language L over ∑={a,b} such that every strings either start with “a” or end with “b”. The minimum number of states in DFA of L are ___
4
Correct Answer
Option 1
Solution
Start with “a”: a(a+b)*
Product Automata:
Min DFA: State BP and BQ are equivalent
End with “b”: (a+b)*b
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider the following statements
S1: The equivalence of a regular grammar and a DCFL is decidable.
S2: The equivalence of a NFA and a NPDA is decidable.
Select the correct option.
Both S1 and S2 are correct
Both S1 and S2 are false.
S1 is correct while S2 is false
S1 is false while S2 is correct.
Correct Answer
Option 3
Solution
The equivalence of DCFL and regular is a decidable problem. But equivalence of regular language and CFL (NPDA) is undecidable. Hence S1 is correct but S2 is false.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following FA over ∑={a,b}
Select the correct regular expression which is equivalent to corresponding to the given FA.
(aa+ab+ba+bb)*
a((a+b)(b+a))* a+ b((a+b)(b+a))*b + ϵ
(aa+bb)* + (ab+ba)*
None of the above
Correct Answer
Option 1
Solution
The given FA accept ((a+b)(a+b))*
Which is equivalent to (aa+ab+ba+bb)*
Reg expr: (aa+bb)* + (ab+ba)* does not generate string “aaab” hence it cannot be correct.
Reg expr: a((a+b)(b+a))* a+ b((a+b)(b+a))*b + ϵ does not generate string “ab” hence it cannot be correct.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following Turing machine, (β means Blank Symbol)
Select correct value of P and Q , if the language recognized by TM is
L={a^n b^n | n > 0}
P=(x,x,L) Q= (y,y,R)
P=(x,x,L) Q= (y,y,L)
P=(x,x,R) Q= (y,y,L)
P=(x,x,R) Q= (y,y,R)
Correct Answer
Option 4
Solution
The TM first changes the “a” into “x” and then skip all next a’s (and y’s) and convert the corresponding “b” into “y”. If the number of a’s and b’s are equal then at the end all a’s has converted into “x” and all “b’s” has converted into “y’s” at state q0.
Suppose TM start from q0 with input “βaabbβ” on reaching q2 , the input will be
“βxaybβ”, head is at “y” , now on q2 (y,y,L ), head will be on “a” {string-> “βxaybβ}, using (a,a,L) on q2, it will be (βxaybβ) . Now P must be (x,x,R) because again we have to convert next “a” into “x”.
In the second iteration suppose second “a” is also converted into “x” and second “b” is converted into “y” at state q2 like -> {βxxyyβ} suppose head is at “y” on q2. Using transition P (x,x,R) , it will reach to state q0 and head is on first “y” like -> {“βxxyyβ}. So on state if head is on “y” means all “a’s are over and we need to move on q3 and hence the transition Q will be (y,y,R) and on q3 self loop (y,y,R) will lead to “β” at end (iff number of a’s and b’s are equal) and on reaching β (blank) means number of a’s and b’s are equal hence accept.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar.
S-> S1 | 1S1 | ϵ
Numbers of parse tree for string “1111” are ____
5
Correct Answer
Option 1
Solution
The string “1111” can be derived by the following ways.
1. Using S->S1 four times (it can be done in only one way)
2. using S->1S1 two times (it can be done in only one way)
3. Using one S-> 1S1 and two S->S1 (it can be done in three ways)
So Total 5 ways
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider the following grammar:
X→XY | 1
Y-> Y1 | 1
Select the correct option:
The grammar is LL(1) as well as SLR(1)
The grammar is CLR(1) but not LL(1)
The grammar is CLR(1) but not LALR(1)
The grammar is ambiguous
Correct Answer
Option 4
Solution
The given grammar is ambiguous, as it has two parse trees for string “1111”. So, none of the above is true.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Select the correct statement from the given option. [MSQ]
In S-attributed SDT , semantic action can be written anywhere in the production body at RHS.
For S-attributed SDT it is favourable to use Top down parser.
S-attributed SDT is also known as postfix SDT.
L-attributed SDT has both synthesized as well as inherited attributes, but inherited attribute is allowed to take value from parent or left siblings only.
Correct Answer
Option 3,4
Solution
In S-attributed SDT , semantic action can be written only at the end of the production in RHS.
S-attributed SDT uses Bottom up parser.
S-attributed SDT is also known as postfix SDT.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider the following SDD having two productions.
Production 2 follows S-attributed definition but not L-attributed definition.
This SDD follows only the L-attributed definition but not S-attributed definition.
Production 1 has only inherited attributes.
None of the above.
Correct Answer
Option 3
Solution
It is not S-attributed as A.val (in P1) is an inherited attribute. It is not L-attributed as A.val is depending on B1.val, since in L-attributed definition is:
Each attribute must be either
1. Synthesized
2. Inherited, but with the rules limited as follows. Suppose that there is a production A→ X1 X2…Xn and that there is an inherited attribute Xi.a computed by a rule associated with this production. Then the rule may use only:
a. Inherited attributes associated with the head A.
b. Either inherited or synthesized attributes associated with the occurrences of symbols X1, X2,. . . , Xi-1 located to the left of Xi.
Production 2 follows both S attributed as well as L attributed definition, as in L attributed only synthesized is also allowed and P2 has synthesized attribute.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the given below regular expressions over ∑={a,b}
r1: (a*b+ b*a)*
r2: (aa*+bb*)*
The regular expression for L(r1) ∩ L(r2) is:
Φ
{ϵ}
(a*+b*)*
None
Correct Answer
Option 3
Solution
r1: (a*b+ b*a)* = (a+b)* , as we can assume a* and b* as epsilon, which will give (a+b)* and since (a+b)* is superset of all possible language over {a,b} hence
(a*b+ b*a)* == (a+b)* .
r2: Similarly (aa*+bb*)* = (a+b)* , if we assume a* and b* as epsilon.
So r1=r2=(a+b)* and their intersection is also equal to (a+b)* which is also equal to (a*+b*)*
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Identify the correct statement(s).
Responsibilities of Transaction-management component: [MSQ]
Ensures that the database remains in a consistent state despite Power failures
Ensures that the database remains in a consistent state despite Operating system crashes
Ensure the consistency of the database during interaction among the concurrent transactions
Ensure consistency of database by orchestrating all access requests issued by the transactions
Correct Answer
Option 1,2,3,4
Solution
Responsibilities of transaction management are:
· Ensures that the database remains in a consistent state despite Power failures
· Ensures that the database remains in a consistent state despite Operating system crashes
· Ensure the consistency of the database during interaction among the concurrent transactions
· Ensure consistency of database by orchestrating all access requests issued by the transactions
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Which of the following statements is/are CORRECT?
S1: CHECK constraints enforce domain integrity
S2: UNIQUE constraints enforce the uniqueness of the values in a set of columns
Only S1
Only S2
Both S1 and S2
Neither S1 nor S2
Correct Answer
Option 3
Solution
CHECK constraints enforce domain integrity
UNIQUE constraints enforce the uniqueness of the values in a set of columns
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider following two relations r1 and r2:
Identify the number of tuples in r1 ⨝ r2?
5
6
7
20
Correct Answer
Option 3
Solution
The natural of r1 and r2 will have 7 tuples.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Find names of employees with years of experience greater than at least one employee in the Accounts department. Identify the correct, "SQL Query" for this statement. [MSQ]
SELECT name FROM employee WHERE years_exp IS GREATER THAN (SELECT DISTINCT years_exp FROM employee WHERE dept_name = 'Accounts');
SELECT distinct E.name FROM employee AS E, employee AS F WHERE E.years_exp > F.years_exp AND F.dept_name& = 'Accounts';
SELECT name FROM employee WHERE years_exp > GREATER ( SELECT years_exp FROM employee WHERE dept_name = 'Accounts');
SELECT name FROM employee WHERE years_exp > SOME ( SELECT years_exp FROM employee WHERE dept_name = 'Accounts');
Correct Answer
Option 2,4
Solution
Both the following queries will return the employees with years of experience greater than at least one employee in the Accounts department:
a) SELECT distinct E.name FROM employee AS E, employee AS F WHERE E.years_exp > F.years_exp AND F.dept_name& = 'Accounts';
b) SELECT name FROM employee WHERE years_exp > SOME ( SELECT years_exp FROM employee WHERE dept_name = 'Accounts');
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Which of the following implementations of C library functions are NOT straight-forward invocations of the underlying system calls?
exit ();
fork ();
strlen();
None of these
Correct Answer
Option 3
Solution
strlen(); is a function (user defined or library), which does not invoke a system call directly in its definition.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Which of the following actions by a running process will always result in a context switch
A system call.
Servicing a timer interrupt.
Servicing a disk interrupt.
None of these.
Correct Answer
Option 1
Solution
A system call always requires OS support. Therefore, a running process will be context switched with the OS kernel module. Rest of them may not always result in a context switch.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider a parent process that has forked a child process in the program below:
int a = 50;
int fd = fopen(...); //opening a file
int ret = fork();
if(ret >0) {
fclose(fd);
a = 60;
} else if(ret==0) {
printf("a=%d\n", a);
read(fd, something);
}
After the child process is forked, suppose that the parent process is scheduled first, before the child process. Assume that the child process is scheduled for the first time only after the parent completes its execution. Now which of the following statement(s) is/are TRUE ? (Assume that the OS implements a regular fork, with no virtual memory) [MSQ]
The value of the variable a as printed in the child process is 50.
The value of the variable a as printed in the child process is 60
The attempt to read from the file descriptor (fd) succeeds in the child.
The attempt to read from the file descriptor (fd) fails in the child.
Correct Answer
Option 1,3
Solution
The fork system call returns 0 to child and any integer > 0, to the parent. On fork the entire code is cloned in the child. If part is executed by the parent after fork, and else part is executed by the child. The parent makes a=60 and closed file descriptor. The child however has a=50, which is printed after execution. As the file descriptor (fd) is also copied during the fork, the child can use it even though the parent has closed it.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the information about the following processes :
The CPU utilization using the First Come First Serve (FCFS) Scheduling policy is :
100%
95.2%
90.47%
85.71%
Correct Answer
Option 4
Solution
Gantt chart :
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A certain page table entry in the page table of a process has both the valid and present bits set, now which of the following is TRUE in the context of TLB and memory access ?
A TLB hit occurs, always.
A page fault will occur.
A TLB hit or miss may occur, cannot say.
None of these
Correct Answer
Option 3
Solution
Valid and present bits in a page entry of the page table indicates that the page is valid and present in the main memory. Therefore, a page fault cannot occur. We cannot say a TLB hit or miss occurs, as the page entry may or may not be loaded into TLB
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider an IP router with Maximum Transferable Unit (MTU) of 500 B has received an IP datagram of size 3000 B with an IP header of length 15 B. Which of the following is true about IP fragments generated by routers for this packet?
Number of fragments = 6, last fragment offset and datagram length 306 and 120
Number of fragments = 7, last fragment offset and datagram length 300 and 120
Number of fragments = 7, last fragment offset and datagram length 360 and 120
Number of fragments = 6, last fragment offset and datagram length 300 and 120
Correct Answer
Option 3
Solution
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider an instance of TCP’s Additive Increase Multiplicative Decrease (AIMD) algorithm where the window size at the start of slow start phase is 1 MSS and the threshold at the start of 1st transmission is 16 MSS. Assume TCP use over a lossy link i.e., timeout occurs after transmission of the 7th packet . What is the congestion window size at the end of 14 RTT (in MSS)?
9
11
12
14
Correct Answer
Option 3
Solution
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider Three-way Handshaking for TCP connection termination is shown below:
Which of the following is false?
S1 : Loss of ACK from client doesn’t affect termination of connection.
S2 : The client moves FIN-Wait-1 → FIN-Wait-2 → closed in the state machine on no packet loss.
S3 : Loss of ACK from server restricts termination of connection.
S1 and S2 only
S2 and S3 only
S1and S3 only
S2 only
Correct Answer
Option 2
Solution
• Loss of ACK from client does not effect on termination of connection because client use timeout timer, after it expire it send “ACK” and goes in closed state, where if server does not receive “ACK” then its timer expire and send FIN segment one more time and termination of connection. So True
• Loss of ACK from the server does not affect since when the client receives FIN from the server, then the client understands that “ACK” was lost. So False
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider an IPv4 network, each host can generate packets with a rate of 500 packets per second. If each Packet host in the network is identified by a unique identification number 48 bits, then the host wrap around time for generating packets will be ________ (in sec). [Closest integer value]
131
120
141
102
Correct Answer
Option 1
Solution
= 2^48 / (2^32 x 500 ) = 131.07 = 131
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
In a casino, the table person selects a card at random and announces that it's a black card.
What is the probability that its a club
1/2
1/4
12/52
1/8
Correct Answer
Option 1
Solution
Its already announced that its a black card, so the sample space is 26 ( there r 26 black cards). Out of which the clubs are 13.
Thus prob = 13/26 = 1/2
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Schumacher, Vettel, Rossy, Hamilton, Juan, Prost are attending a party. There are four women Mirja, Sharapova, Joli and Kate joined the party. The max number of ways the couple dance can be performed such that each women must be joined by a man is ____
360
Correct Answer
Option 1
Solution
The first woman can be joined with 1 out of 6 men (i..e in 6 ways).
Second woman in 5 ways, and third 4, last woman has 3 ways.
In total 6x5x4x3 = 360 ways the pairs can be formed
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
If determinant of a matrix is -162, then which of the following can be the eigenvalues of that matrix
[MSQ]
{ 18,1, -9}
{ 9,-9,-2}
{ -81, -1,-2 }
{9,-9, 27}
Correct Answer
Option 1,3
Solution
The product of the eigenvalues is the Determinant of the matrix.
Out of the given options, 18*1*-9 = -162, -81*-1*-2 = -162
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
12
Correct Answer
Option 1
Solution
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
The number of teas sold in a shop per minute are 4. What is the probability that 62 teas are sold in 15 minutes?
0.0066
0.0619
0.6116
0.6993
Correct Answer
Option 1
Solution
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The inclusion of which of the following sets into
A = {{a,b,d}, {a,b,x}, {a,b,z}, {a,b,x,z}, {a,b,d,x,z}}
is necessary and sufficient to make ‘A’ a complete lattice under the partial order defined by set containment?
{a}
{b}
{a,b}
{a,b,x,z}
Correct Answer
Option 3
Solution
A lattice should have GLB, LUB. With the given set ‘A’, we get three lower bounds {a,b,d}, {a,b,x}, {a,b,z}. Out of the given options either {a} or {b} or {a,b} can make a complete lattice.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Round of to one decimal only.
0.5
Correct Answer
Option 1
Solution
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
The number of ways a five letter word with district letters be formed with {w, x,y,z,a,b,c,d}
_______________
6720
Correct Answer
Option 1
Solution
The number of ways of forming a 5 distinct letters word out of 8 distinct is 8P5 = 6720
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
An interrupt in which the external device supplies the interrupt requests as well as the starting address of the interrupt service routine is called as:
Vectored interrupt
Non-vectored interrupt
Designated interrupt
Maskable interrupt
Correct Answer
Option 1
Solution
By definition, in a vectored interrupt the interrupting device provides the starting address of the ISR. Hence option A is true.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
A non-pipelined system takes 72ns to execute a task, the same task is run on a six-staged pipeline with clock cycle time of 12ns. What is the speedup achieved with the pipelined execution over the non-pipelined system if a program with 100 tasks is executed on both?
6.28
5.45
5.92
5.71
Correct Answer
Option 4
Solution
We can take each task mentioned here is one instruction.
It is given that each task takes 72ns in the non-pipelined execution.
Time taken for 100 tasks in the non-pipelined execution = 100*72ns
In a pipeline with k stages, time taken to execute a program of n instructions = k+n-1 clock cycles
Here k = 6 and n = 100
So time in the pipeline = 6+100-1 = 105 clock cycles
Each clock cycle time = 12ns
Time in the pipeline = 105*12 ns
Speed up = Time without pipeline / Time with pipeline = 100*72 / 105*12 = 5.71
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Which of following addressing modes requires more number of memory accesses
Immediate
Direct
Indirect
Implied
Correct Answer
Option 3
Solution
In the immediate addressing mode, the operand is provided in the instruction itself, so it doesn’t require a memory access to load the operand.
Direct addressing mode has the effective address of the operand in the instruction, it requires one memory access to get the operand.
Indirect addressing requires two memory accesses the operand as the address of the address is given in the instruction.
Implied addressing mode doesn’t require a memory access to load the operand as it is a basic operation on special registers, ex: INCA (to increment the accumulator), CLA (Clear accumulator) etc
Hence out of all the given options Indirect addressing mode requires more memory accesses.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Choose the correct statement/s from the below: [MSQ]
Memory mapped I/O has separate memory and I/O address spaces.
Memory-mapped I/O uses the same set of read,write control lines for both memory and I/O transfers.
Isolated I/O has distinct input and output instructions.
Memory mapped I/O has distinct input and output instructions.
Correct Answer
Option 2,3
Solution
Option A is false as memory mapped I/O has same address space for memory and I/O.
Option B is true as memory-mapped I/O uses the same set of read, write control lines for both memory and I/O transfers.
Option C is true as isolated I/O has distinct input, output instructions.
Option D is false memory mapped I/O has same input and output instructions.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider a 2-way set associative mapping where there are 8 cache blocks (0 – 7). Given the following main memory block access pattern (0, 4, 9, 5, 16, 13, 15, 19, 25, 63, 24, 57, 30), if LRU cache replacement is used choose the main memory block number which is not present in the cache at the end of the access________
15
63
19
30
Correct Answer
Option 1
Solution
Cache size = 8 blocks
In a 2-way set associative cache there will be 2 blocks in each set.
Number of sets in the cache = 8/2=4
We can place the block in the set given by (blocknum)%(number of sets).
0, 4, 9, 5, 16, 13, 15, 19, 25, 63, 24, 57, 30
From the given options main memory block 15 is not in the cache at the end of the access as it got replaced by 63
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A function f(A,B,C) is implemented by the following 4x1 multiplexer.
Which of the following is NOT a minterm of the function f(a,b,c)?
5
4
6
7
Correct Answer
Option 1
Solution
From the figure,
f(A,B,C)= AB’ C’ + AB.1
= AB’C’ + ABC’ + ABC
= m4 + m6 + m7
f(A,B,C)= M0M1M2M3M5.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Which of the following statements is true?
XOR is a neutral function
XNOR is not a neutral function
Both
None
Correct Answer
Option 1
Solution
In a neutral function, the number of minterms is equal to the number of maxterms. The functions XOR and XNOR are neutral functions.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Let A= 1101 and B= 0111 are the two signed binary numbers represented in 2’s complement form. Which of the following statements is true if A and B are added? [MSQ]
Overflow doesn’t occur
Result is a positive number
Overflow occurs
Result is a negative number
Correct Answer
Option 1,2
Solution
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
let f1 = a’b’+b’c, and f2= ac+bc’. Which of the following expressions represent f1+f2?
a’b’ + ac + bc’
a’c’ + b’c + ab
a’c’ + b’c + ac
a’b’ + ac + a’c’
Correct Answer
Option 1,2
Solution
It is a cyclic K-map.
f1+f2= a’b’ + ac + bc’
or
f1+f2= a’c’ + b’c + ab
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Let A and B are bit strings of length k. If An is A XORed with itself n times and Bn is B XNORed with itself n times, An ⊕ Bn=______? (⊕ represents XOR)