GATE CS 1999 (original) (raw)
Given the programming constructs
_i) assignment
ii) for loops where the loop parameter cannot be changed within the loop
_iii) if-then-else
iv) forward go to
_v) arbitrary go to
_vi) non-recursive procedure call
_vii) recursive procedure/function call
_viii) repeat loop,
which constructs will you not include in a programming language such that it should be possible to program the terminates (i.e. halting) function in the same programming language.
Which of the following actions is/are typically not performed by the operating system when switching context from process A to process B?
- Saving current register values and restoring saved register values for process B.
- Changing address translation tables.
- Swapping out the memory image of process A to the disk.
- Invalidating the translation look-aside buffer.
Consider the following C function definition.
int Trial (int a, int b, int c) { if ((a >= b) && (c < b) return b; else if (a>=b) return Trial(a, c, b); else return Trial(b, a, c); }
The function Trial:
- finds the maximum of a, b and c
- finds the minimum of a, b and c
- finds the middle number of a, b and c
If T1 = O(1), give the correct matching for the following pairs:
(M) Tn=Tn−1+n (U) Tn=O(n) (N) Tn=Tn/2 +n (V) Tn=O(nlogn) (O) Tn=Tn/2 +nlogn (W) T=O(n^2) (P) Tn=Tn−1 +logn (X) Tn=O(log^2n)
The minimum number of record movements required to merge five files A (with 10 records), B (with 20 records), C (with 15 records), D (with 5 records) and E (with 25 records) is:
A sorting technique is called stable if:
- It takes O(n*log(n)) time
- It maintains the relative order of occurrence of non-distinct elements
- It uses divide and conquer paradigm
Suppose we want to arrange the ii numbers stored in an array such that all negative values occur before all positive ones. Minimum number of exchanges required in the worst case is:
If one uses a straight two-way merge sort algorithm to sort the following elements in ascending order 20, 47, 15, 8, 9, 4, 40, 30, 12, 17 then the order of these elements after the second pass of the algorithm is:
- 8, 9, 15, 20, 47, 4, 12, 17, 30, 40
- 8, 15, 20, 47, 4, 9, 30, 40, 12, 17
- 15, 20, 47, 4, 8, 9, 12, 30, 40, 17
- 4, 8, 9, 15, 20, 47, 12, 17, 30, 40
Listed below are some operating system abstractions (in the left column) and the hardware components or mechanism (in the right column) that they are abstractions of. Which of the following matching of pairs is correct?
A. Thread 1. Interrupt B. Virtual address space 2. Memory C. File system 3. CPU D. Signal 4. Disk
Which of the following is/are advantages of virtual memory? a) Faster access to memory on an average. b) Processes can be given protected address spaces. c) Linker can assign addresses independent of where the program will be loaded in physical memory. d) Programs larger than the physical memory size can be run.
There are 70 questions to complete.
Take a part in the ongoing discussion