Placement Papers: GlobalEdge Latest Fresher Question Paper 5 2005

Download PDF of This Page (Size: 133K)

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

  1. union u { int ival; float fval; char * sval; } size of u is

    1. 8 bytes

    2. 4 bytes

    3. compile time error

    4. 12

    Ans (b)

  2. struct x { int i; int j; int k; }; struct x * p; struct x arr[3]; p = &arr[0]; p + +; what is p pointing to

    1. pointing to i of arr[0]

    2. pointing to j of arr[0]

    3. pointing to k of arr[1]

    4. pointing to i of arr[1]

    Ans: (d)

  3. struct a { int b; }; struct b { int b; }; int main () { struct a first; struct b second; first. b = 10; second = first; printf ( “%d” second. b); }

    1. 10

    2. garbage

    3. compile error

    4. run time error

    Ans: c

  4. What is the Output of the Program? #define max “hello” main () { printf (max); }

    1. compilation error

    2. Preprocessing error

    3. runtime error

    4. hello

    Ans (d)

  5. What is the Output of the Program? #define max main () main () { max; printf ( “hello wolrd\n” ); }

    1. compilation error

    2. Preprocessing error

    3. runtime error

    4. executes until the stack overflows

  6. What is the Output of the Program? typedef int * p; main () { int a = 90; p p1; p1 = &a; printf ( “%d” * p1); }

    1. 90

    2. compilation error

    3. runtime error

    4. none of the above

    Ans (a)

  7. What is the Output of the Program? main () { int i = 1; printf (i? “one” “zero” ); }

    1. one

    2. zero

    3. error

    4. both and b

    Ans (a)

  8. What is the Output of the Program? main () { int i = 1; printf ( “%d” i? 1: 0); }

    1. 1

    2. 0

    3. error

    4. none of the above

  9. What is the Output of the Program? main () { int a = 90, b = 100; a + +; a = (ab) ^ (a = b); b = ab^a; a; printf ( “%d %d” a + +, b + + ); }

    1. 90 100

    2. 100 90

    3. 101 91

    4. 91 101

    Ans (a)

  10. What is the Output of the Program? main () { int a = 10, b = 100; swap (&a, &b); printf ( “%d %d” a, b); } swap (int * a, int * b) { * a = * a + * b; * b = * a- * b; * a = * a- * b; swap1 (&a, &b); } swap1 (int * * a, int * * b) { * * a = * * a + * * b; * * b = * * a- * * b; * * a = * * a- * * b; }

    1. 100 10

    2. 10 100 (1)

    c lvalue is required in fun main

    d. Error!

    Ans (b)

  11. What is the Output of the Program? main () { void * ptr; int a = 10; ptr = &a; printf ( “%d” * ptr); }

    1. error

    2. 10

    3. 20

    4. none

    Ans (1)

  12. What is the Output of the Program? main () { void * ptr; int a = 90; char * ptr1 = “hello” ptr = a; ptr = ptr1; }

    1. executes w/o any error

    2. compilation error

    3. runtime error

    4. none

    Ans (a)

  13. What is the Output of the Program? main () { char * p = “helloo” char * p1 = “strcat” while ( ( * (p + + ) = * (p1 + + ) )! = ‘\0’ ) {; } }

    1. error

    2. address is copied

    3. contents are copied

    d. None

    Ans (c)

  14. What is the Output of the Program? int g = 10; main () { int a = 10; printf ( “%d” a); } int g

    1. 10

    2. 11

    3. error

    4. none

    Ans (a)

  15. What is the Output of the Program? main () { int a = 1; int b = 0; a = a + + ± -b * a + +; printf ( “%d” a); }

    1. error

    2. none

    3. 1

    d. 2

    Ans (d)

  16. What is the Output of the Program? struct s { int si; union u { float uf; char uc; }; }; main () { printf ( “%d” sizeof (struct s) ); }

    1. 8

    2. 3

    3. 6 @

    4. 7

  17. What is the Output of the Program? struct st { int a; char b; } main () { }

    1. struct st is return type of main@

    2. main is a variable of struct st.

    3. Compilation error

    4. Run time error

    Ans (A)

  18. What is the Output of the Program? typedef struct info { int i; char b; } node; main () { struct info node1; node1. i = 55; printf ( “%d” node1. i); }

    1. 55

    2. Not possible to use struct info

    3. Compilation error

    4. Garbage value.

    Ans (A)

  19. What is the Output of the Program? struct a { int i; int display () { printf ( “hello world\n” ); } }; main () { strcut a vara; vara. Display (); }

    1. hello

    2. hello world

    3. Compile time error

    4. garbage

  20. What is the Output of the Program? struct a { int ( * ptr) (); }; int display () { printf ( “Global Edge\n” ); } main () { struct a structa; structa. Ptr = display; structa. Ptr (); }

    1. Global Edge

    2. Address of display function

    3. address of structa

    4. Error

    Ans (A)

  21. What is the Output of the Program? typedef int * ABC; typedef ABC XYZ[10]; int main () { XYZ var; }

    1. var is an array of integer pointers.

    2. var is a pointer to an integer array.

    Options:

    1. only 1 is correct.

    2. only 2 is correct.

    3. both 1 and 2 are correct.

    4. typedef statements are in wrong order.

    Answer: b

  22. What is the Output of the Program? union tag { int a; char x; char y; }name (Assume Storage is Little Endian technique); int main () { name. a = 258; printf ( “\n x = %d y = %d” name. x, name. y); }

    1. x = 1 y = 1

    2. x = 2 y = 2

    3. x = 1 y = 2

    4. x = 2 y = 1

    Answer: b

  23. Consider the Program, int main () { int a[20]; int * p, * q, val; p = &a[0]; q = &a[10]; val = q-p; printf ( “p %u q %u val %d” p, q, val); } Assume p = 1000, what is the value of q and val?

    1. q = 1020 val = 20

    2. q = 1020 val = 10

    3. q = 1010 val = 10

    4. q = 1010 val = 20

    answer: b

  24. Consider the Program, struct key { char * word[2]; int count; char c; }abc; int main () { printf ( “\nsize %d” sizeof (abc) ); } What is the size of abc?

    1. 8

    2. 7

    3. 6

    4. 5

    Answer: b

  25. What is the output of the program? main () { #define x 5 int b; b = x; printf ( “%d” b); }

    1. Compiler Error

    2. Runtime error

    3. Garbage value

    4. 5

  26. What is the output of the following program? main () { int a; #define y 10 a = y; printf ( “%d” a); }

    1. 10

    2. Compiler error

    3. Run-time error

    4. Garbage value

  27. What will be printed on the screen? #define s − 50 main () { int s; #ifdef s printf ( “Hell\n” ); #else printf ( “Heaven\n” ); #endif }

    1. Hell

    2. Heaven

    3. Compilation error

    4. HellHeaven

  28. Which of ‘Arrays’ or ‘pointers’ are faster?

    1. Arrays

    2. pointers

    3. Both take same time

    4. Can't say

  29. How many times can a comment be nested?

    1. COMMENT_NEST_LIMIT times

    2. COMMENT_LIMIT times

    3. ONE time

    4. Not even Once R

  30. Which one MUST be correct in the following statements?

    1. All Identifiers are keywords

    2. All Keywords are Identifiers

    3. Keywords are not Identifiers

    4. Some keywords are Identifiers

    Ans (A)

  31. Select the choice which is wrong?

    1. ‘volatile’ is a reserved word

    2. ‘volatile’ is a keyword

    3. ‘volatile’ is a data type

    4. ‘volatile’ is a Identifier

    Ans (C)

  32. Consider the following Program main () { int i, j; i = 06; j = 09; printf ( “%d %d\n” i, j); }

  33. What would be the output?

    1. 6 9

    2. 6 11

    3. 06 09

    4. Compilation Error

  34. What happens when we compile this program? # undef __FILE__ # define __FILE__ “GLOBALEDGE” main () { printf ( “%s\n” __FILE__); }

    1. Compilation Error

    2. Run-Time Error

    3. Compiles But gives a Warning

    4. Compiles Normally

  35. What happens when we compile this program? # define LINE # define NAME “GESL” main () { printf ( “%d” “%s\n” LINE, NAME); }

    1. Compilation Error

    2. Compiles but Warns

    3. Syntax Error

    4. Compiles Normally

  36. int main () { int i = 5; if (1) { static int i; i + +; printf ( “%d” i); } printf ( “%d” i); }

    1. error

    2. 5, 0

    3. 5, 1

    4. 1, 5

    Ans (d)

  37. int main () { int a[4] = { 23, 67, 90}; printf ( “%d” a[3]); }

    1. junk

    2. error

    3. 0 (ans)

    4. 1

  38. int main () { int i = 1, 2; printf ( “%d” i); }

    1. 1

    2. 2

    3. error

    4. none

    Ans (c)

  39. int main () { int i; for (i = 0; i + + ) { i = i + 2; break; printf ( “%d” i); } }

    1. 0

    2. 2

    3. error

    4. none (ans)

    Ans (d)

  40. int main () { int i; i = 1, 2; printf ( “%d” i); }

    1. 1 (ans)

    2. 2

    3. error

    4. none

  41. #include <stdio. h> int i = 20; int maxlen = i; int main () { int j = i; printf ( “i = %d, j = %d\n” i, j); }

    1. i = 20, j = 20

    2. i = 20, j = junk

    3. error

    4. none

    Ans (c).

  42. int main () { int i = 10; printf ( “%d” j); printf ( “%d” i); } int j = 20

    1. j = 20, i = 10

    2. j = junk, i = 10

    3. compile time error

    4. runtime error

    Ans (c)

  43. int i = 20; int i, j = 10; main () { int j = 20; printf ( “i = %d, j = %d\n” i, j); }

    1. redeclaration error

    2. i = 20, j = 10

    3. i = 20, j = 20 (ans)

    4. none

  44. int main () { int k = 2, i = 10; while (k--) { printf ( “%d\n” disp (i) ); } } disp (int k) { static int i = 0; return i = i + k; }

    1. 10, 10

    2. 10, 20 (ans)

    3. 20, 10

    4. none

  45. header files usually contains

    1. only definitions

    2. only declarations (ans)

    3. both

    4. compiled code for functions

  46. int main () { int i = 3; while (i--) { int i = 10; printf ( “%d” i); } }

    1. 10, 9, 8, 7, ____1

    2. 10, 10, 10, 10, …

    3. 10, 10, 10 (ans)

    4. none

  47. char s[] = “hello\0 world” printf ( “%s…%d” s, strlen (s) ); What is the output?

    1. hello…5

    2. hello\0 world…12

    3. hello…12

    4. compile time error

    ans: (a)

  48. printf ( “%%% s” “hello” ); What is the output?

    1. %%%s

    2. %%%

    3. %hello

    4. hello

    ans: (c)

  49. What does fgetc return

    1. char

    2. int

    3. unsigned int

    4. void

    ans: (b)

  50. int i = 24; printf ( “%xd” i); What is the output?

    1. 18

    2. 24

    3. 18d

    4. compile time error

ans: (c)