Placement Papers: C Questions What is the Output

Download PDF of This Page (Size: 105K)

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

  1. main () { char a[2]; * a[0] = 7; * a[1] = 5; printf ( “%d” &a[1]-a) } ANS: Ans may be 1 (illegal initialization).

  2. #include main () { char a[] = “hellow” char * b = “hellow” char c[5] = “hellow” printf ( “%s %s %s” a, b, c); printf ( “” sizeof (a), sizeof (b), sizeof (c) ); } (ans is hellow, hellow, hellow 6, 2, 5)

  3. #include main () {float value = 10.00; printf ( “%g %0.2g %0.4g %f” value, value, value, value) } (ans is 10, 10, 10, 10.000000)

  4. #include void function1; int i-value = 100; main () { i-value = 50; function1; printf ( “i-value in the function =” i-value); printf ( “i-value after the function =” i-value); }

printf ( “i-value at the end of main =” i-value); functioni () i-value = 25.