Placement Papers: SQL Star TechnicalC

Examrace Placement Series prepares you for the toughest placement exams to top companies.

  1. If a b c is input, then the following program results char x, y, z; printf (%d, scanf (%c %c %c, &x, &y, &z) )

  2. Choose syntactically incorrect statement

  3. Find the output int a = 4, b = 6; printf (%d, a = = b)

    1. error message

    2. 0

    3. 1

    4. none

  4. Find output while (printf (%d, printf (az) ) ) printf (by)

  5. Find the output main () { inc (); inc (); inc (); } inc () { static int x; printf (%d, + + x); }

  6. What will be the output of the following? main () { int k = 35; printf ( “\n %d %d” k>40); }

  7. What is the output of the program? void main () { static int I = 5; printf (I = %d, i--); if (i) main (); }

  8. What is the output of the program? void main () { char * p = %d\n: Int I = 5; printf (p, I); }

  9. #include int a = 45; #define a 10 main () { Printf (%d, a); }

    1. 10

    2. 45

    3. Lvalue required

    4. Compilation error

  10. Predicts error in followings display (char * ); main () { Char string[ ] = Hello\0 World; } Void display (char * string) { Printf (%s, string) }

  11. #define C − 2 Main () { C = 89; Printf (c = %d, c); }

  12. main () Enum { (A, B = 1, C); B = 45; Printf (%d\n, B); }

    1. 45

    2. 1

    3. Compilation error

    4. Lvalue required

  13. With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?

  14. char * myfunc (char * ptr) { Ptr + = 3; Return (ptr); } Int main () { Char * x, * y; X = HELLO; Y = myfunc (x); Printf (y = %s\n, y); Return 0; } What will print when the sample code above is executed?

    1. y = HELLO

    2. y = ELLO

    3. y = LLO

    4. y = LO

    5. x = O

  15. int x[] = (1, 4, 8, 5, 1, 4); int * ptr, y; ptr = x + 4; y = ptr-x; What does y in the sample code above equal?

  16. What is the output of the following program? #include #include main () { typedef union { int a; a char b[10]; float c; } Union; Union x, y = { 100}; x. a = 50; strcpy (x. b, “hello” ); x. c = 21.50; printf ( “Union x: %d %s %f n” x. a, x. b, x. c); printf ( “Union y: %d %s %f n” y. a, y. b, y. c); }

  17. What is the output of this Program? main () { char * p1 = name; char * p2; p2 = (char * ) malloc (20); memset (p2, 0, 20); while ( * p2 + + = * p1 + + ); printf (%s\n, p2); }

  18. main () { int x = 20, y = 35; x = y + + + x + +; y = + + y + + + x; printf (%d%d\n, x, y); }

  19. #define swap (a, b) a = a + b; b = a-b; a = a-b; void main () { int x = 5, y = 10; swap (x, y); printf (%d %d\n, x, y); swap2 (x, y); printf (%d %d\n, x, y); } int swap2 (int a, int b) { int temp; temp = a; b = a; a = temp; return 0; }

  20. Predict the output or error (s) for the following: #include main () { struct xx { int x = 3; char name[] = “hello” }; struct xx * s; printf ( “%d” s → x); printf ( “%s” s → name); }

  21. Analyze the output #include main () { char s[] = { ‘a’ ‘b’ ‘c’ ‘\n’ ‘c’ ‘\0’ }; char * p, * str, * str1; p = &s[3]; str = p; str1 = s; printf ( “%d” + + * p + + + * str1 − 32); }

  22. #include main () { int a[2][2][2] = { { 10, 2, 3, 4}, { 5, 6, 7, 8} }; int * p, * q; p = &a[2][2][2]; * q = * * * a; printf ( “%d____%d” * p, * q); }

    1. SomeGarbageValue____1

    2. 10, 2, 3, 4, 5, 6, 7, 8

    3. compiler error

    4. no output

  23. main () { char * p = “hai friends” * p1; p1 = p; while ( * p! = ‘\0’ ) + + * p + +; printf ( “%s %s” p, p1); }

    1. ibj! gsjfoet

    2. hai friends

    3. compiler Error

    4. data is insufficient

  24. main () { static char names[5][20] = { “pascal” “ada” “cobol” “fortran” “perl” }; int i; char * t; t = names[3]; names[3] = names[4]; names[4] = t; for (i = 0; i ⇐ 4; i + + ) printf ( “%s” names[i]); }

    1. Compiler error: Lvalue required in function main

    2. pascal, ada, cobol, fortran, perl

    3. garbage value

    4. pascal, ada, cobal, fortran.

  25. void main () { int const * p = 5; printf ( “%d” + + ( * p) ); }

    1. 5

    2. 6

    3. 2546

    4. Compiler error: Cannot modify a constant value.

  26. #include #define clrscr () 100 main () { clrscr (); printf ( “%d\n” clrscr () ); }

    1. 100

    2. clrscr ()

    3. output screen will be cleared

    4. in valid declaration in line number 2

  27. Predict the output or error (s) for the following: #include main () int i, j; for (i = 0; i ⇐ 10; i + + ) { j + = 5; assert (i<5); }

    1. Runtime error: Abnormal program termination.

    2. Linker Error

    3. Warning: Function should return a value

    4. Executes without any error

  28. main () { int i = -1; + i; printf ( “i = %d, + i = %d \n” i, + i); }

    1. Compilation Error in line no 5

    2. Compilation Error in line no 4

    3. garbage value

    4. i = -1, + i = -1

  29. main () { char * cptr, c; void * vptr, v; c = 10; v = 0; cptr = &c; vptr = &v; printf ( “%c%v” c, v); }

    1. ASCII equivalent value of c, 0

    2. 10, 0

    3. Compiler error (at line number 4)

    4. 48, 0

Sign In