Programming and Data Structure Solved MCQs- Part 2
Programming and Data Structure Solved MCQs- Part 2 Unsigned integers occupies Two bytes Four bytes One byte Eight byte A weather forecasting computation requires 250 billion floating point operations. The problem is processed in a supercomputer that ca perform 100 mega flops. How long will it take to do these calculations. 4167 min 40 min 52.67 min 60.12 min The value that follows the keyword CASE may only be Constants Variable Number Semicolon A data structure whose elements from a sequence is known as Non-linear Data Structure Linear Data Structure Homogeneous Data Structure Heterogeneous Data Structure
The process of production of customer list in alphabetical order falls under the category of Editing Sorting Updating Calculating If an array is used as function argument, the array is passed By value By reference By name The array cannot be used as a function argument Binary search tree is an example of Divide and conquer Greedy algorithm Back tracking Dynamic programming The earliest calculating devices are Abacus Clock Difference None of these Which of the following data structure is non-linear type? Strings Lists
Stacks None of above What value would the following function return for the input x=95 Function fun (int x) if(x>100) return fun(x-10) else return fun(fun(x+11)) 91 90 89 92 A data structure in which linear sequence is maintained by pointers is known as Pointer based data structure Stack Array Linklist The information about an array used in a program will be sorted in Symbol table Activation table System table Dope vector What does the following fragment of C-program print?
char c[] "GATE2011"; char *p =c; printf ("%s", p+p[3]-p [1] ); GATE2011 E2011 2011 011 From the point of view of the programmer, what are the major advantages of using a high-level language rather than internal machine code or assembly language? Program portability Easy development Efficiency None of the above By default real number is treated as Float Double Long double Far double Which of the following data structure is used to represent relationship between pairs, where relationship is not hierarchical? Graph Tree Hash Table Queue What is the output of the following program segment? main()
int i = ++2; printf( %d\n, i); 3 2 0-1 C allows a three-way transfer of control with the help of Unary operator Relational operator Ternary operator Comparison operator The postfix expression AB + CD * can be evaluated using a stack tree queue linked list C language was invented by Abacus Charles babage Thomson Dennis Ritchie What is the output of the following program segment? main() int i = 1; do
printf( %d.., i); while(i--); 0..1.. 1..0.. 0-1 Suppose a circular queue of capacity (n -1) elements is implemented with an array of n elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are full: (REAR+1) mod n == FRONT empty: REAR == FRONT full: (REAR+1) mod n == FRONT empty: (FRONT+1) mod n == REAR full: REAR == FRONT empty: (REAR+1) mod n == FRONT full: (FRONT+1) mod n == REAR empty: REAR == FRONT Consider the following sequence of operations : (i) Pointer p1 is set to point at a new heap-dynamic variable. (ii) Pointer p2 is assigned p1 value. (iii) The heap dynamic variable pointed to by p1 is explicitly de-allocated, but p2 is not changed by the operation. This situation leads to which of the following : p1 becomes a dangling pointer p2 becomes a dangling pointer Both p1 and p2 are now dangling pointers Neither p1 nor p2 is now a dangling pointer
Consider the following program main ( ) float a = 0.5, b = 0.7; if (b < 0.8) if (a < 0.5) printf ( ABCD ); else printf ( PQR ); else printf ( JKLF); The output is ABCD PQR JKLF None of these What would be the output of the following program, if run from the command line as myprog 1 2 3? main (int argc, char * argv[ ]) int i ; i = argv[1] + argv[2] + argv[3] ; printf ( % d, i) ; 123 6 Error 123 The expression P >> 6 shifts all bits of P six places to right. What is the value of P >> 6 if P 0.6db7? 0.1234 0.0001 0.0000 0.1B6 The process of accessing data stored in a serial access memory is
similar to manipulating data on a Heap Queue Stack Binary tree Queue is a ----------- list. LIFO LILO FILO FIFO Linked lists are not suitable data structures for which one of the following problems Insertion sort Binary search Radix sort Polynomial manipulation The << operator is used for Right shifting Right shifting Bitwise shifting Bitwise complemen In a circular linked list Components are all linked together in some sequential manner There is no beginning and no end Components are arranged hierarchically
Forward and backward traversal within the list is permitted If binary tree has n leaf nodes,then number of nodes of degree 2 in T is log 2 n n-1 n 2n Consider the following C code segment. int a, b, c = 0; void prtfun(void); main( ) static int a = 1; /* Line 1 */ prtfun( ); a += 1; prtfun( ); printf( \n %d %d, a, b); void prtfun(void) static int a = 2; /* Line 2 */ int b = 1; a += ++b; printf( \n %d %d, a, b); What output will be generated by the given code segment? 3 1 4 1 4 2 4 2 6 1 6 1 4 2 6 2 2 0 3 1 5 2 5 2
Following sequence of operations is performed on a stack: PUSH (10), PUSH(20), POP,PUSH (10), PUSH (20),POP, POP, POP, PUSH (20), POP 20,10,20,10,20 20,20,20,10,20 20,10,20,10,10 20,20,10,10,20 Output of the program given below is int i; main() printf( %d, i) 1 0-1 NULL Usually, an algorithm will contain a number of procedural steps which are dependent on results of previous steps and is called. Flowchart Chart Drawing Chart Food Chart What would be output of the following program? # define SQR(X) (X*X) main() int a, b=3; a = SQR(b+2); printf( \n%d, a); 25 11 Error
Garbage value The efficient data structure to insert/delete a number in a stored set of numbers is Queue Linked list Doubly linked list Binary tree How many times the following program would print ( abc )? main() printf( \nabc ); main(); Infinite number of times 32767 times 65535 times Till the stack does not overflow When the following code is executed what will be the value of x and y? int x = 1, y = 0; y = x++; 2,1 2,2 1,1 1,2 Which of the following is a bad example of recursion? Factorial Fibonacci numbers Tower of Hanai
Tree traversal An advantage of choosing this implementation of \set of integers" is that adding an element to a set is a contact time operation. Which of the following is a disadvantage of this implementation? Adding elements to a very small sets could cause error flags to be raised. Deleting elements from very large sets could cause error ags to be raised. Deleting elements from very large sets could cause error ags to be raised. Constructing the union of two sets will require quadratic time in the size of the set being constructed. The number of different directed trees with 3 nodes are 2 3 4 5 What would be output of the following program, if the array begins at 65486? main() int arr[ ] = 12, 14, 15, 23, 45; printf( %u%u, arr+1, &arr+1); 65486, 65486 65488, 65488 65488, 65496 None of the above The name of all functions end with a Pair of parenthesis
Semicolon Braces Colon A template stores Styles, macros Auto Text entires, Customized word command Settings Graphics, text All of the above What would be output of the following program? # define SQR(X) (X*X) main() int a, b=3; a = SQR(b+2); printf( \n%d, a); 25 11 Error Garbage value The decimal value 0.5 in IEEE single precision floating point representation has fraction bits of 000 000 and exponent value of 0 fraction bits of 000 000 and exponent value of -1 fraction bits of 100 000 and exponent value of 0 no exact representation Queues serve a major role in Simulation of recursion
Simulation of arbitrary linked list Simulation of limited resources Expression evaluation Number of binary trees formed with 5 nodes are 32 64 120 42