You are on page 1of 7

Question No 1 What is the output of the following program? #include<stdio.

h> int foo(int a[]) { return sizeof(a)/sizeof(int); } int main(void) { int arr[5]; printf("%d ",foo(arr)); return 0; } 5 Compiler Error RUNTIME Error none of these Clear Selected Answer Question No 2 A connect() from a client will succeed after a server has called the following socket call socket() bind() listen() accept() Clear Selected Answer Question No 3 A given graph G is an Euler graph iff all vertices of G are of Same degree Even degree Odd degree Different degree Clear Selected Answer Question No 4 A TCP/IP session is setup between two machines and the the initial seqnumber that the sender will use is 1. The sender sends 256 bytes and the receiver recevies all 256 bytes in one shot and sends back an acknowledgment packet (ACK) which also contains a acknowledgement number field to acknowledge the bytes received. Given standard TCP semantics what would be the ack number contained in this ACK packet. 1 2

Building an index on EMPLOYEES.AGE = 24 order by E. What is the complexity of merging these two binary heaps.256 257 Clear Selected Answer Question No 5 Consider the following SQL query: select * from EMPLOYEES E where E. This is intended to find all records in the employees table whose AGE is 24 and list them ordered by their salary. There is no index on any attribute of the EMPLOYEES table. O(n) O(n^2) O(log n) .SALARY. Statement 1. Now consider the following two statements. Building an index on EMPLOYEES.AGE can improve the performance of the query in some cases Statement 2.SALARY can improve the performance of the query in some cases Which of these statements are true? Only statement 1 is true Only statement 2 is true Both statements are true Both statements are false Clear Selected Answer Question No 6 Which of the following is a reason why somebody might prefer a RISC-based computer architecture over a CISC-based computer architecture It is difficult to debug programs on CISC computers It is much more difficult to write compilers that make good use of CISC CPUs It is possible to have to pipelined execution in RISC machines RISC is more suitable for scientific applications Clear Selected Answer Question No 7 Given two binary heaps. each containing ' n' elements The heaps have the property that each parent node has a value greater than or equal to each of its child nodes.

i=%d ". i=10 . } TRUE. the same set of books is used irrespective of who is teaching that course.i). Question 1: What is the primary key for this table? COURSE_ID COURSE_ID. In general the signal Can be handled by any thread of the process. PROFESSOR. Clear Selected Answer Question No 9 Consider the following table: Schema 1: COURSE_ID PROFESSOR TEXTBOOK PHY_101 Ranade Intro to Physics PHY_101 Ranade Basic Physics PHY_101 Nambiar Intro to Physics PHY_101 Nambiar Basic Physics CHEM_101 Abhyankar Intro to Physical Chemistry CHEM_101 Abhyankar Intro to Organic Chemistry MECH_101 Ranade Basic Physics MECH_101 Ranade Basic Mechanics Note that the set of professors who teach a course is independent of the set of textbooks used for that course . i=%d ". Signals are not handled in a multithreaded process. PROFESSOR COURSE_ID.O(nlogn) Clear Selected Answer Question No 8 A multithreaded process is running under unix/linux. (Parent thread is the one which created all other threads) Only a pre-designated thread handles the signal. Will be handled by the parent thread only. else printf("FALSE. return 0. TEXTBOOK COURSE_ID. A signal is generated and sent to this process.e. TEXTBOOK Clear Selected Answer Question No 10 What is the output of the following program? #include<stdio.h> int main(void) { unsigned int i=10.i). if( i>-5 && ++i>5 ) printf("TRUE.i.

3. i=11 Clear Selected Answer Question No 11 What is the output of the following program? #include<stdio.TRUE. At startup the master thread spawns of 10 worker threads and then has to wait till all the 10 threads complete their job. return 0. X) P(SEM) Each worker thread executes V(SEM) before it exits after completing its job What is the value of X? 10 -10 . Question: The master thread executes two statements after sqawning the threads init_sem(SEM. integer v) initialises the value of semaphore s with v P(semaphore s): standard P() operation on semaphore V(semaphore s): standard V() operation on semaphore A multithreaded process has 1 master thread and 10 worker threads.168.168.i). while() { if(! --i) break. All the threads share a global semaphore SEM.168.42. Clear Selected Answer Question No 13 Given the legend for semaphores: init_sem(Semaphore s. } printf("%d ". i=10 FALSE.3 Sends the packet back to the router with a flag set. i=11 FALSE.42.42.2 gets a packet destined to another host 192.h> int main(void) { int i=10. None of the above. What does it do? Discards the packet Forwards the packet to 192. } 0 10 Compiler Error none of these Clear Selected Answer Question No 12 If a host machine (not a router) with an IP of 192.

A program cannot move to a position occupied by another program. Here is the logic of the program running on A and B status = FAIL. The signal handlers and the signal masks are not shared at all. They are only handled by the parent thread. Both programs start exactly at the same time t=0 and start to execute the above logic. return status. Given a two by two grid represented by 1 2 3 4 A and B share the grid structure. else move to the adjacent free location } return status. OS. memory and environmental factors are same for both programs Under the above conditions and assumptions: the programs individually come to completion with SUCCESS status the programs are in a state of deadlock . Clear Selected Answer Question No 16 A and B are two computer programs. Both programs run uninterrupted on different processors. All conditions of processor speed/type/make. The programs cannot move diagonally. A starts at position 1 and has to reach 4 and B starts at position 2 and has to reach position 3. In other words the grid structure is a global.-9 9 Clear Selected Answer Question No 14 Which one of the statements is false? mmap() system call under unix/linux can be used to map a regular file of a disk based filesystem cannot be used to map a directory can be used to map a socket cannot be used to map a socket Clear Selected Answer Question No 15 A process has a set of signal handlers and a signal mask. while(1) { if position == destination position then status = SUCCESS. When this process creates new threads the signal handlers and the signal masks are copied over to individual threads' state the signal handlers are shared among all the threads and the signal mask is copied over to indviduals thread's state All the threads share the same signal handlers and the signal mask.

rotating point (x. y) about the origin clockwise by 90 degrees. return 0. atexit(fn). This program will print "In Main" forever. rotating point (x. Very few allow hashtable based indexes. Clear Selected Answer Question No 19 What is the ouput of the following function? void fn(void). } void fn(void) { main. Which of the following in your opinion is the most likely reason for this: A B-Tree index lookup is always faster than a hash-table based index lookup A B-Tree index is much easier to implement than a hash-table based index A hash-table based index cannot be used for answering range queries (i. y) about the origin counter-clockwise by 45 degrees. y) about the origin counter-clockwise by 90 degrees. } This program will not compile. This program will print "In Main" once.The programs are in a state of livelock the programs individually come to completion but with FAIL status Clear Selected Answer Question No 17 Most databases these days allow users to build B-Tree indexes. Clear Selected Answer Question No 20 . y) about the origin clockwise by 45 degrees.e. main(). rotating point (x. This program will not link. is analogous to: rotating point (x. queries of the form "x < CONSTANT") A hash-table based index wastes a lot of disk-space and memory on empty buckets to reduce collisions Clear Selected Answer Question No 18 Multiplying a complex number (x + iy) by i. main() { printf ("In Main "). the square root of -1.

} get() { return(20). printf("%d".x).What is the output of the following program? main() { const int x=get(). } error 20 garbage value 0 Clear Selected Answer .