GATE CS question library
Practise GATE CS Computer Science previous year questions free. Browse by subject, syllabus topic, year and question type, with answers and available solutions.
Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.
20 on this page
A processor uses page tables for virtual to physical address translation. Page tables for both levels are stored in the main memory. Virtual and physical addresses are both bits wide. The memory is byte addressable. For virtual to physical address translation, the most significant bits of the virtual address are used as index …
Consider the following assembly language program for a hypothetical processor and are bit registers. The meanings of various instructions are shown as comments. MOV B, #0 ; MOV C, #8 ; Z: CMP C, #0 ; compare C with 0 JZ X ; jump to X if zero flag is set SUB C, #1 ; RRC A, #1 ; right …
In a permutation , of distinct integers, an inversion is a pair such that and What would be the worst case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of with at most inversions?
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i=100, j=5; void P(x) { int i=10; print(x+10); i=200; j=20; print (x); } main() {P(i+j);} If the programming language uses dynamic scoping and call by name parameter passing mechanism, the values …
Suppose we want to synchronize two concurrent processes and using binary semaphores and . The code for the processes and is shown below. …
Consider the following circuit composed of XOR gates and non-inverting buffers. The non-inverting buffers have delays and as shown in the figure. Both XOR gates and all wires have zero delays. Assume that all gate inputs, outputs, and wires are stable at logic level at time . If the following waveform is …
In a min-heap with elements with the smallest element at the root, the smallest element can be found in time
Consider the function defined below. struct item { int data; struct item * next; }; int f(struct item *p) { return ((p == NULL) || (p->next == NULL)|| ((p->data <= p ->next -> data) && f(p->next))); } For a given linked list , the function returns if and only if
Consider the C program shown below: #include<stdio.h> #define print(x) printf("%d", x) int x; void Q(int z) { z+=x; print(z); } void P(int *y) { int x = *y + 2; Q(x); *y = x - 1; print(x); } main(void) { x = 5; P(&x); print(x); } The output of this program is:
In the following program fragment, , , and TwoLog_n are integer variables, and is an array of integers. The variable is initialized to an integer , and TwoLog_n is initialized to the value of for (k = 3; k <= n; k++) A[k] = 0; for (k = 2; k <= TwoLog_n; k++) for (j = k+1; j …
Consider three data items and and the following execution schedule of transactions and In the diagram, and denote the actions reading and writing the data item respectively. …
Consider the set of relations shown below and the SQL query that follows. Students: (Roll_number, Name, Date_of_birth) Courses: (Course_number, Course_name, Instructor) Grades: (Roll_number, Course_number, Grade) Select distinct Name from Students, Courses, Grades where Students.Roll_number=Grades.Roll_number and Courses.Instructor = 'Korth' and …
Consider the following functional dependencies in a database. …
Host is sending data to host over a full duplex link. and are using the sliding window protocol for flow control. The send and receive window sizes are packets each. Data packets (sent only from to ) are all bytes long and the transmission time for such a packet is . Acknowledgment packets (sent …
A long broadcast LAN has bps bandwidth and uses CSMA/CD. The signal travels along the wire at m/s. What is the minimum packet size that can be used on this network?
The subnet mask for a particular network is Which of the following pairs of addresses could belong to this network?
Suppose we want to synchronize two concurrent processes and using binary semaphores and . The code for the processes and is shown below. Process P: Process Q: while(1){ W: print '0'; print '0'; X: } while(1){ Y: print '1'; print '1'; Z: } Synchronization statements can be inserted only at points and Which …
A uni-processor computer system only has two processes, both of which alternate CPU bursts with I/O bursts. Both the processes were created at nearly the same time. The I/O of both processes can proceed in parallel. Which of the following scheduling strategies will result in the least CPU utilization (over a long …
Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statistically linked libraries?
Consider the following class definitions in a hypothetical Object Oriented language that supports inheritance and uses dynamic binding. The language should not be assumed to be either Java or C++, though the syntax is similar. Class P { Class Q subclass of P { void f(int i) { void f(int i) { print(i); print(2*i); } } } } Now consider the following program …
