You are on page 1of 7

data structures [1] Which of the following statements are correct regarding conditional operato rs? A.

We can use the conditional operators only in arithmetic statements. B. The conditional operators can be nested. Choice a Only A is correct. Choice b Only B is correct. Choice c Both A and B are correct. Choice d Neither A nor B is correct. [2] Which of the following is the correct way of declaring a float pointer? Choice a float ptr ; Choice b float *ptr ; Choice c *float ptr ; Choice d None of the above [3] What is the default return type of a function? Choice a void Choice b int Choice c double Choice d No return type [4] Which of the following shows the correct hierarchy of airthmetic operations in C? Choice a / + * Choice b * - / + Choice c + - / * Choice d * / + [5] Which of the following statements are correct regarding switch? A. It is mandatory to arrange all the cases in ascending order. B. The default case is optional. Choice a Only A is correct. Choice b Only B is correct. Choice c Both A and B are correct. Choice d Neither A nor B is correct. [6] Which of the following statements are correct regarding loop control in structions? A. We can drop the initialisation, testing and incrementation in for loop. B. We cannot use data type other than int as a loop counter. Choice a Only A is correct. Choice b Only B is correct. Choice c Both A and B are correct. Choice d Neither A nor B is correct. [7] Which of the following statement is used to ta e the control to the begin ning of the loop? Choice a exit Choice b brea Choice c continue Choice d None of the above 8] Which of the following eyword is not used in switch statement? Choice a default Choice b case Choice c brea Choice d continue [9] If you don't initialize an array, what would be the initial value of elemen ts? Choice a 0

Choice b Garbage value Choice c A floting point number Choice d The character constant '\0' [10] When you pass an array to a function, what actually gets passed? Choice a An address of the array Choice b Values of the elements of the entire array. Choice c Only an address of the first element of the array. Choice d The number of elements of the array. [11] Which of the following statements are correct regarding arrays? A. While declaring and initializing the 2-D array at the same place, mentioni ng the column dimension is optional. B. Array elements can be accessed using the position of the element in the ar ray. Choice a Only A is correct. Choice b Only B is correct. Choice c Both A and B are correct. Choice d Neither A nor B is correct. [12] Which of the following is not a eyword in C? Choice a long Choice b register Choice c typedef Choice d automatic 13] What is the difference between the 5's in these two expressions? int num[ 5 ] ; num[ 5 ] = 11 ; Choice a First is particular element, second is type. Choice b Both specify array size. Choice c First is array size, second is particular element. Choice d First is particular element, second is array size. [14] An expression contains relational operators, assignment operators and arithmetic operators. In the absence of parantheses, they will be evaluated in which of the following order: Choice a Assignment, relational, arithemtic Choice b Arithemtic, relational, assignment Choice c Relational, arithmetic, assignment Choice d Assignment, arithmetic, relational [15] In what sequence the initialisation, testing and execution of body is don e in a do-while loop? Choice a Initialisation, execution of body, testing Choice b Execution of body, initialisation, testing Choice c Initilisation,testing,execution of body Choice d None of the above [16] Which of the following is the default storage class for variables declare d within a function? Choice a Automatic Choice b Static Choice c Register Choice d Extern [17] Which of the following is used to combine more than one conditions? Choice a Conditional operators Choice b Arithmetic operators Choice c Logical operators Choice d Bitwise operators [18] Which of the following operator reverses the value of the expression it o perates on? Choice a != Choice b ! Choice c | Choice d || [19] Which of the following is not a decision ma ing media in C?

Choice Choice Choice Choice

a b c d

if-else statement switch statement Logical operators Conditional operators

[20] In which of the following cases tne result of condition 1 || condition 2 will be true? A. If both the operands are false. B. If one of the operand is true and other is false. C. If both the operands are true. Choice a Only in case C Choice b Only in case A Choice c Only in case A and B Choice d Only in case B and C [21] What is the advatage of the binary search method? Choice a It reduces the number of elements to be searched from n to n/2. Choice b It chec s sequentially for every element, which ma es it efficien tly. Choice c Both (i) and (ii) Choice d None of the above [22] The rate of increase in algorithm with order log n is Choice a 0.5 Choice b 1.0 Choice c 1.5 Choice d 2.0 [23] Consider following code snippet: void sumprod ( int, int, int, int *, int * ) ; void main( ) { int a = 10, b = 20, c = 30, s, p ; sumprod ( a, b, c, &s, &p ) ; printf ( "%d %d", s, p ) ; } void sumprod ( int x, int y, int z, int *ss, int *yy ) { *ss = x + y + z ; *yy = x * y * z ; } What would be Choice a Choice b Choice c Choice d the output of the above code? 6000 6000 60 60 60 6000 6000 60

[24] Consider following code snippet: void main( ) { int , num = 30 ; = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) ; printf ( "%d", num ) ; } What would be Choice a Choice b Choice c Choice d

the output of the above code? 100 200 500 30

[25] Consider following code snippet:

float square ( float ) ; void main( ) { float a = 3.5, b ; b = square ( a ) ; printf ( "%0.2f", b ) ; } float square ( float x ) { float y ; y = x * x ; return ( y ) ; } What would be the output of the above code? Choice a 12.00 Choice b 12.25 Choice c Choice d 12.35 11.25

[26] Consider the following code snippet: void main( ) { printf ( "%d %d %d %d", 72, 072, 0x72, 0X72 ) ; } What will be the output of the above program? Choice a 72 072 0x72 0X72 Choice b 72 0 72 114 Choice c 72 58 114 114 Choice d 72 72 114 114 [27] Consider the following code snippet: #define NO #define YES void main( ) { int i = 5, j ; if ( i > 5 ) j = YES ; else j = NO printf ( "%d", j ) ; } Which of the Choice a Choice b Choice c Choice d following statement is correct about the above program? The code reports an error. The code causes an exception. The code gives output NO The code gives output garbage value

[28] Consider following code snippet: void main( ) { int x = 15 ; printf ( "%d %d %d", x != 15, x = 20, x < 30 ) ; }

What would be Choice a Choice b Choice c Choice d

the output of the above code? 0 20 1 0 20 0 1 20 0 1 20 1

[21] Which of the following searching method wor s only on sorted list? Choice Choice Choice Choice a b c d Linear Bubble Binary None of the above

[22] Which of the following searching method is the fastest one? Choice a Linear Choice b Binary Choice c Merge Choice d one of the above [23] void main( ) { int i = -1, j = 4 ; switch ( i /= j / i ) { default: printf ( "%d", case 1: printf ( "%d", brea ; case 2: printf ( "%d", brea ; case 3: printf ( "%d", brea ; } } Which of the following statement is correct about the above program? Choice a The code reports an error. Choice b The code causes an exception. Choice c The code gives output 0 Choice d The code gives output 0 0 [24] Consider the following code snippet: void main( ) { int i = 120, j = 250, ; = fun ( !++i, !j++ ) ; printf ( "%d %d %d", i, j, ) ; } int fun ( int i, int j ) { int ; = i + j ; return ; } What will be the output of the above program? Choice a 121 250 0

i ) ; i ) ; i ) ; i ) ;

Choice b Choice c Choice d

121 251 0 121 250 371 121 251 371

[25] Consider following code snippet: void sumprod ( int, int, int, int *, int * ) ; void main( ) { int a = 10, b = 20, c = 30, s, p ; sumprod ( a, b, c, &s, &p ) ; printf ( "%d %d", s, p ) ; } void sumprod ( int x, int y, int z, int *ss, int *yy ) { *ss = x + y + z ; *yy = x * y * z ; } What would be Choice a 6000 6000 Choice b Choice c Choice d the output of the above code? 60 60 60 6000 6000 60

[26] Consider following code snippet: void main( ) { int i = 1, j = 1 ; for ( ; ; ) { if ( i > 5 ) brea ; else j += i ; printf ( "%d ", j ) ; i += j ; } } What would be Choice a Choice b Choice c Choice d the output of the above code? 2 5 2 5 8 2 4 6 2 3 4

[29] Consider the following code snippet: void main( ) { int i = 0, j = 5, = 10, l ; // Add statement here printf ( "%d ", l ) ; } Which of the following statement is correct that will be added to the above code to get the output 300?

Choice a

l = i > 1 ? j > 1 ||

> 1 ? 100 : 300 : 200 ;

Choice b Choice c Choice d

l = i > 1 ? j > 1 || l = i > 1 ? j > 1 || l = i > 1 ? j > 1 ||

> 1 ? 300 : 200 : 100 ; > 1 ? 300 : 100 : 200 ; > 1 ? 100 : 200 : 300 ;

You might also like