# GATE 2020 - Programming and Data Structures Test 2

This Test will cover complete Programming and Data Structures with very important questions, starting off from basics to advanced level.
Q. The worst case time required to search a given element in a sorted linked list of length `n` is?
 A. O(1) B. O(log n) C. O(n) D. O(n logn)
Q. When key values are real, a similar data representation might be produced by using a hashing function with?
 A. Mod B. Div C. Trunc D. Log N
Q. The average time required to perform a successful sequential search for an element in an array `A(1:n)` is given by?
 A. (n+1)/2 B. Log(n) C. n(n+1)/2 D. n*n
Q. Using the standard algorithm, what is the time required to determine that a number `n` is prime?
 A. Linear time B. Logarithtmic time C. Constant time D. Quadratic time

Q. Which of the following is most appropriate?
 A. `int *matrix;.....;free(void) matrix;` B. `int *matrix;.....;free(matrix);` C. `int *matrix;.....;if(matrix!=null) free(void*) matrix` D. None of these
Q. If the space occupied by `null` terminated string "S1" and "S2" in "c" are respectively "m" and "n", the space occupied by the string obtained by concatenating "S1" and "S2" is always?
 A. Less than m+n B. Equal to m+n C. Greater than m+n D. None of these
Q. Given 2 sorted list of size 'm' and 'n' respectively. Number of comparisons needed in the worst case by the Merge Sort algorithm will be?
 A. mn B. max(m,n) C. min(m,n) D. m+n-1
Q. The order of an algorithm that finds whether a given boolean function of 'n' variables, produces a 1 is?
 A. Constant B. Linear C. Logarithmic D. Exponential
Q. Which of the following is not a Primitive Recursive but Partially Recursive?
 A. Carnot's function B. Ricmann function C. Bounded function D. Ackermann's function

Q. What will be the output of the following line of code?
``Printf("%d" printf("tim"));``
 A. Result in a syntax error B. Outputs tim3 C. Outputs garbage D. Print tim and terminates abruptly
Q. If `a` is an unsigned integer variable whose value is `hx6db7`, what is the value of `-a` ?
 A. h11hhhh1 B. hxhh1 C. hx248 D. hx9248
Q. If initialization is a part of declaration of a structure, then storage class can be?
 A. Automatic B. Register C. Static D. Anything
Q. Which of the following is a collection of items into which items can de inserted arbitrarily and from which only the smallest item can be removed?
 A. Descending priority queue B. Ascending priority queue C. FIFO queue D. LIFO queue
Q. Which of the following abstract data types can be used to represent a many to many relation?
 A. Tree, only B. Plex, only C. Graph, only D. Both (b) and (c)
Q. The average search time of hashing, with linear probing will be less if the load factor __________?
 A. Is for less than one B. Equals one C. Is for greater than one D. None of these

### Related Tests:

#### Explore more Subjects:

Tests for various other programming languages and subjects: