Professional Documents
Culture Documents
3 [P.T.O.
14 / 2
8. Consider the following code sequence (A) A smaller block size implies better
having five instructions I1 to I5. Each of spatial locality
these instructions has the following format.
(B) A smaller block size implies a smaller
OP Ri, Rj, Rk cache tag and hence lower cache tag
Where operation OP is performed on overhead
contents of registers Rj and Rk and the result (C) A smaller block size implies a larger
is stored in register Ri. cache tag and hence lower cache hit
I1: ADD R1, R2, R3 time
I2: MUL R7, R1, R3 (D) A smaller block size incurs a lower
I3: SUB R4, R1, R5 cache miss penalty
4
11. Consider the following C program: 13. What will be the output of the following C
#include <stdio.h> program?
int r(){ void count(int n){
static int num=7; static int d=1;
return num--; printf("%d ", n);
} printf("%d ", d);
int main(){ d++;
for (r();r();r()) if(n>1) count(n-1);
printf("%d",r()); printf("%d ", d);
return 0; }
}
Which one of the following values will be void main(){
displayed on execution of the programs? count(3);
(A) 41 }
(B) 52 (A) 3 1 2 2 1 3 4 4 4
(C) 63 (B) 3 1 2 1 1 1 2 2 2
(D) 630 (C) 3 1 2 2 1 3 4
(D) 3 1 2 1 1 1 2
12. Consider the following C program.
void f(int, short); 14. What is the output of the following C code?
void main() Assume that the address of x is 2000
{ (in decimal) and an integer requires four
int i = 100; bytes of memory?
short s = 12; int main( )
short *p = &s; {
__________ ; // call to f() unsigned int x[4][3] =
} {(1, 2, 3), {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};
Which one of the following expressions, printf("%u, %u, %u", x+3, *(x+3),
when placed in the blank above, will NOT *(x+2)+3);
result in a type checking error? }
(A) f(s,*s) (A) 2012, 4, 2204
(B) i = f(i,s) (B) 2036, 2036, 2036
(C) f(i,*s) (C) 2036, 10, 10
(D) f(i,*p) (D) 2012, 4, 6
5 [P.T.O.
14 / 3
15. Abstraction and encapsulation are 17. In case of inheritance where both base and
fundamental principles that underlie the derived class are having constructor and
object oriented approach to software destructor, then which if the following are
development. What can you say about the true ?
following two statements ? 1. Constructors are executed in their order
I. Abstraction allows us to focus on what of derivation
something does without considering 2. Constructors are executed in reverse
the complexities of how it works? order of derivation
II. Encapsulation allows us to consider 3. Destructors are executed in their order
complex ideas while ignoring irrelevant of derivation
detail that would confuse us. 4. Destructors are executed in reverse
(A) Neither I nor II is correct. order of derivation
(B) Both I and II are correct. (A) Only 2, 4
(C) Only II is correct. (B) Only 1, 3
6
class Derived : public Base { }; if ((head = = NULL | | (head->next
int main(void) = = NULL)) return head;
{ q = NULL; p = head;
Derived q; while (p-> next !=NULL) {
return 0; q=p;
} p=p->next;
(A) Compiler Error: there cannot be an }
empty derived class
___________________________
(B) Compiler Error: Derived is abstract
return head;
(C) No compiler Error
}
(D) None of the above
20. How can we restrict a function to throw Choose the correct alternative to replace the
certain exceptions? blank line.
(A) Defining multiple try and catch block (A) q = NULL; p->next = head; head = p;
inside a function (B) q->next = NULL; head = p; p->next
(B) Defining generic function within try = head;
block (C) head = p; p->next = q; q->next =
(C) Defining function with throw clause NULL;
(D) It is not possible in CPP to restrict a (D) q->next = NULL; p->next = head;
function head = p;
21. The following C function takes a singly- 22. A circular queue has been implemented
linked list as input argument. It modifies the using a singly linked list where each node
list by moving the last element to the front consist of a value and a single pointer
of the list and returns the modified list. Some pointing to the next node. We maintain
part of the code is left blank. exactly two external pointers FRONT and
typedef struct node { REAR pointing to the front node and rear
int value; node of the queue, respectively. Which of
the following statement is/ are CORRECT
struct node *next;
for such a circular queue, so that insertion
} Node; and deletion operations can be performed in
Node *move_to_front(Node *head) { O(1) time?
Node *p, *q;
7 [P.T.O.
14 / 4
I. Next pointer of front node point to the What is the worst case time complexity of
rear node. a sequence of n queue operations on an
II. Next pointer of rear node points to the initially empty queue?
front node. (A) (n)
(A) I only (B) (n + k)
(B) II only (C) (nk)
(C) Both I and II (D) (n2)
(D) Neither I nor II
23. Suppose a stack implementation supports an 25. The preorder traversal sequence of a binary
instruction REVERSE, which reverses the search tree is 30, 20, 10, 15, 25, 23, 39, 35,
order of elements on the stack, in addition 42. Which one of the following is the
to the PUSH and POP instructions. Which postorder traversal sequence of the same
one of the following statements is TRUE tree?
with respect to this modified stack? (A) 10, 20, 15, 23, 25, 35, 42, 39, 30
(A) A queue cannot be implemented using (B) 15, 10, 25, 23, 20, 42, 35, 39, 30
this stack. (C) 15, 20, 10, 23, 25, 42, 35, 39, 30
(B) A queue can be implemented where (D) 15, 10, 23, 25, 20, 35, 42, 39, 30
ENQUEUE takes a single instruction
and DEQUEUE takes a sequence of
26. A B-tree of order 4 is built from scratch by
two instructions.
10 successive insertions. What is the
(C) A queue can be implemented where
maximum number of node splitting
ENQUEUE takes a sequence of three
operations that may take place?
instructions and DEQUEUE takes a
(A) 3
single instruction.
(B) 4
(D) A queue can be implemented where
both ENQUEUE and DEQUEUE (C) 5
take a single instruction each. (D) 6
24. Consider the following operation along with 27. Assume that a mergesort algorithm in the
Enqueue and Dequeue operations on worst case takes 30 seconds for an input of
queues, where k is a global parameter. size 64. Which of the following most closely
MultiDequeue(Q){ approximates the maximum input size of a
m=k problem that can be solved in 6 minutes?
while (Q is not empty) and (m > 0) { (A) 256
Dequeue(Q)
(B) 512
m=m-1
(C) 1024
}
(D) 2048
}
8
28. An array n numbers is given, where n is an 31. Which of the following is true about
even number. The maximum as well as the inheritance in Java?
minimum of these n numbers needs to be 1) Private methods are final.
determined. Which of the following is
2) Protected members are accessible
TRUE about the number of comparisons
within a package and inherited classes
needed?
outside the package.
(A) At least 2n - c comparisons, for some
3) Protected methods are final.
constant, c are needed.
4) We cannot override private methods.
(B) At most 1.5n - 2 comparisons are
needed. (A) 1, 2 and 4
(C) At least nlog 2 n comparisons are (B) Only 1 and 2
needed. (C) 1, 2 and 3
(D) None of the above. (D) 2, 3 and 4
30. Consider a situation where swap operation class Sub extends Super
is very costly. Which of the following sorting {
algorithms should be preferred so that the
public Sub(String text)
number of swap operations are minimized
{
in general?
(A) Heap Sort i = 2;
9 [P.T.O.
{ At Point X on line 5, which code is
Sub sub = new Sub("Hello"); necessary to make the code compile?
System.out.println(sub.i); (A) No code is necessary.
} (B) throws Exception
} (C) catch ( Exception e )
(A) 0 (D) throws RuntimeException
(B) 1
(C) 2 35. The following block of code creates a
Thread using a Runnable target:
(D) Compilation Fails
Runnable target = new MyRunnable();
Thread myThread = new Thread(target);
33. Which statement is true?
Which of the following classes can be used
(A) Programs will not run out of memory.
to create the target, so that the preceding
(B) Objects that will never again be used code compiles correctly?
are eligible for garbage collection.
(A) public class MyRunnable extends
(C) Objects that are referred to by other Runnable{public void run(){}}
objects will never be garbage
(B) public class MyRunnable extends
collected.
Object{public void run(){}}
(D) Objects that can be reached from a
(C) public class MyRunnable implements
live thread will never be garbage
Runnable{public void run(){}}
collected.
(D) public class MyRunnable implements
Runnable{void run(){}}
34. public class ExceptionTest
{
36. Recall that Belady's anomaly is that the page-
class TestException extends Exception fault rate may increase as the number of
{} allocated frames increases. Now, consider
public void runTest() throws the following statements:
TestException {} S1: Random page replacement algorithm
public void test() /* Point X */ (where a page chosen at random is replaced)
{ suffers from Belady's anomaly
runTest(); S2: LRU page replacement algorithm suffers
} from Belady's anomaly
10
(A) S1 is true, S2 is true 39. Consider a non-negative counting semaphore
(B) S1 is true, S2 is false S. The operation P(S) decrements S, and
V(S) increments S. During an execution,
(C) S1 is false, S2 is true
20 P(S) operations and 12 V(S) operations
(D) S1 is false, S2 is false are issued in some order. The largest initial
value of S for which at least one P(S)
37. A system shares 9 tape drives. The current operation will remain blocked is ______.
allocation and maximum requirement of tape (A) 4
drives for three processes are shown below: (B) 5
Process Current Maximum (C) 6
Allocation Requirement
(D) 7
P1 3 7
P2 1 6 40. Consider six memory partitions of sizes
P3 3 5 200 KB, 400 KB, 600 KB, 500 KB,
Which of the following best describes 300 KB and 250 KB, where KB refers to
current state of the system? kilobyte. These partitions need to be allotted
(A) Safe, Deadlocked to four processes of sizes 357 KB, 210 KB,
468 KB and 491 KB in that order. If the
(B) Safe, Not Deadlocked
best fit algorithm is used, which partitions
(C) Not Safe, Deadlocked are NOT allotted to any process?
(D) Not safe, Not Deadlocked (A) 200 KB and 300 KB
(B) 200 KB and 250 KB
38. Which of the following is NOT true of (C) 250 KB and 300 KB
deadlock prevention and deadlock avoidance (D) 300 KB and 400 KB
schemes?
(A) In Deadlock prevention, the request
41. Let the set of functional dependencies
for resources is always granted, if the
F = {QR S, R P, S Q}
resulting state is safe
hold on a relation schema X = (PQRS). X
(B) In deadlock Avoidance, the request for
is not in BCNF. Suppose X is decomposed
resources is always granted, if the
into two schemas Y and Z, where Y = (PR)
resulting state is safe
and Z = (QRS).
(C) Deadlock avoidance is less restrictive
Consider the two statements given below.
than deadlock prevention
I. Both Y and Z are in BCNF
(D) Deadlock avoidance requires
knowledge of resource requirements a II. Decomposition of X into Y and Z is
priori dependency preserving and lossless
11 [P.T.O.
Which of the above statement/s is/are 44. A database of research articles in a journal
correct? uses the following schema.
(A) I only (VOLUME, NUMBER, STARTPAGE,
(B) Neither I nor II ENDPAGE, TITLE, YEAR, PRICE)
(C) II Only The primary key is (VOLUME, NUMBER,
(D) Both I and II STARTPAGE, ENDPAGE) and the
following functional dependencies exist in
42. Which of the following relational query the schema.
languages have the same expressive power? (VOLUME, NUMBER, STARTPAGE,
I. Relational algebra ENDPAGE) TITLE
II. Tuple relational calculus restricted to (VOLUME, NUMBER) YEAR
safe expressions (VOLUME, NUMBER, STARTPAGE,
III. Domain relational calculus restricted ENDPAGE) PRICE
to safe expressions The database is redesigned to use the
(A) II and III only following schemas.
(B) I and II only (VOLUME, NUMBER, STARTPAGE,
(C) I and III only ENDPAGE, TITLE, PRICE)
(D) I, II and III (VOLUME, NUMBER, YEAR)
Which is the weakest normal form that the
43. Consider a database implemented using new database satisfies, but the old one does
B+ tree for file indexing and installed on a not?
disk drive with block size of 4 KB. The (A) INF
size of search key is 12 bytes and the size
(B) 2NF
of tree/disk pointer is 8 bytes. Assume that
the database has one million records. Also (C) 3NF
assume that no node of the B+ tree and no (D) BCNF
records are present initially in main memory.
Consider that each record fits into one disk 45. Consider the following database schedule
block. The minimum number of disk with two transactions, T 1 and T2
accesses required to retrieve any record in
S = r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X);
the database is ______.
a1 ; a 2
(A) 6
where ri(Z) denotes a read operation by
(B) 5
transaction Ti on a variable Z, wi(Z) denotes
(C) 4 a write operation by T i on a variable Z and
(D) 3 ai denotes an abort by transaction T i.
12
Which one of the following statements about 48. An organization requires a range of IP
the above schedule is TRUE? addresses to assign one to each of its 1500
computers. The organization has approached
(A) S is non-recoverable
an Internet Service Provider (ISP) for this
(B) S is recoverable, but has a cascading task. The ISP uses CIDR and serves the
abort requests from the available IP address space
(C) S does not have a cascading abort 202.61.0.0/17. The ISP wants to assign an
address space to the organization which will
(D) S is strict minimize the number of routing entries in
the ISP's router using route aggregation.
Which of the following address spaces are
46. A prime attribute of a relation scheme R is
potential candidates from which the ISP can
an attribute that appears
allot any one to the organization?
(A) In all candidate keys of R
I. 202.61.84.0/21
(B) In some candidate key of R
II. 202.61.104.0/21
(C) In a foreign key of R
III. 202.61.64.0/21
(D) Only in the Primary Key of R
IV. 202.61.144.0/21
(A) I and II Only
47. A sender uses the Stop-and-Wait ARQ
(B) II and III only
protocol for reliable transmission of frames.
Frames are of size 1000 bytes and the (C) III and IV only
transmission rate at the sender is 80 Kbps (D) I and IV only
(1Kbps = 1000 bits/second). Size of an
acknowledgment is 100 bytes and the
transmission rate at the receiver is 8 Kbps. 49. Identify the correct order in which a server
The one-way propagation delay is 100 process must invoke the function calls
milliseconds. Assuming no frame is lost, the accept, bind, listen, and recv according to
sender throughput is __________ bytes/ UNIX socket APL
second.
(A) listen, accept, bind, recv
(A) 2000
(B) bind, listen, accept, recv
(B) 2500
(C) bind, accept, listen, recv
(C) 3000
(D) accept, listen, bind, recv
(D) 3500
13 [P.T.O.
50. Which of the following is/are example(s) of
stateful application layer protocols?
(i) HTTP
(ii) FTP
(iii) TCP
(iv) POP3
(A) (i) and (ii) only
(B) (ii) and (iii) only
(C) (ii) and (iv) only
(D) (iv) only
14
ROUGH WORK
15 [P.T.O.
ROUGH WORK
16
ANSWER KEY Senior Skill Instructor CSE IT
1. D 26. A
2. A 27. B
3. D 28. D
4. B 29. B
5. C 30. B
6. A 31. A
7. D 32. D
8. B 33. D
9. D 34. B
10. B 35. C
11. B 36. B
12. D 37. B
13. A 38. A
14. B 39. D
15. A 40. A
16. B 41. C
17. C 42. D
18. A 43. C
19. B 44. B
20. C 45. C
21. D 46. B
22. B 47. B
23. C 48. B
24. A 49. B
25. D 50. C