1. Consider the following nested representation of binary trees: (X Y
Z) indicates Y and Z are the left and right sub trees, respectively, of
node X Note that Y and Z may be NULL, or further nested. Which of the
following represents a valid binary tree?
- (1 2 (4 5 6 7))
- (1( (2 3 4) 5 6)7)
- (1 (2 3 4)(5 67))
- (1 (23 NULL) ( 4 5))
2. Let s be a sorted array of n integers. Let t (n) denote the time
taken for the most efficient algorithm to determine if there are two
elements with sum less than 1000 in s. Which of the following
statements is true?
- t (n) is 0 (1)
- n £ t (n) £ n log 2 n
- n log 2 n £ t (n) <
![](http://www.onestopgate.com/images/gate-cs11.gif)
- t (n) =
![](http://www.onestopgate.com/images/gate-cs12.gif)
3. Aliasing in the context of programming languages refers to
- multiple variables having the same memory location
- multiple variables having the same value
- multiple variables having the same identifier
- multiple uses of the same variable
4. Consider the following C declaration
struct {
short s [5]
union {
float y;
long z;
}u;
} t;
Assume that objects of the type short, float and long occupy 2 bytes, 4
bytes and 8 bytes, respectively. The memory requirement for variable t,
ignoring alignment considerations, is
(a) 22 bytes (b) 14 bytes
(e) 18 bytes (d) 10 bytes
5. The number of tokens in the following C statement
printf("i=%d, &i= %x", i, &i);
is
6. Which of the following derivations does a top-down parser use
while parsing an input string? The input is assumed to be scanned in
left to right order.
(a) Leftmost derivation
(b) Leftmost derivation traced out in reverse
(c) Rightmost derivation
(d) Rightmost derivation traced out in reverse
7. Which of the following need not necessarily be saved on a context switch between processes?
- General purpose registers
- Translation look aside buffer
- Program counter
- All of the above
8. Let m [0]….m [4] be mutexes (binary semaphores) and P [0] ... P
[4] be processes. Suppose each process P executes the following :
wait (m ); wait (m [(i + 1) mode 4]);
……..
release (m ) ; release (m[(i + 1) mod 4 ] );
This could cause
- Thrashing
- Deadlock
- Starvation, but not deadlock
- None of the above
9. B + -trees are preferred to binary trees in databases because
- Disk capacities are greater than memory capacities
- Disk access is much slower than memory access
- Disk data transfer rates are much less than memory data transfer rates
- Disks are more reliable than memory
10. Given the relations
employee (name, salary, deptno), and
department (deptno, deptname, address) .
which of the following queries cannot be expressed using the basic
relational algebra operations ( s , p , ´ , |X|, È , Ç , - )?
(a) Department address of every employee
(b) Employees whose name is the same as their department name
(c) The sum of all employee salaries
(d) All employees of a given department
------------- For more papers visit:
http://onestopgate.com/gate-preparation// - http://onestopgate.com/gate-preparation//
|