Placement Papers: GSSL C Questions

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

WHAT IS THE OUT PUT FOR FOLLOWING PROGRAMS

  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 < stdio. h > 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 < stdio. h > 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 < stdio. h > 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; THIS IS ROUGH IDEA OF THE PROGRAM ANS ARE
    1. i-value in the function = 25
    2. i-value after the function = 50
    3. i-value at the end of the main = 100
  5. main () {funct (int n) ; {switch (n) case1: m = 2; break; case2: m = 5; break; case3: m = 7; break; default: m = 0;} }

THIS IS ROUGH IDEA:

(ANS: Out put is m = 0)

REMAINING 5 PROGRAMS SOME WHAT LARGE AND COMPLICATED.