Computer Knowledge

Programming Output Evaluation

1,721 Questions

Programming output evaluation tests the ability to trace code execution in languages like C, Java, and SAS. It focuses on arrays, loops, pointers, and data type conversions. These technical questions are standard in computer knowledge sections for IT officer and bank exams.

Java string bufferC language pointersLoop execution outputsData type conversionsMacro variable evaluation

Programming Output Evaluation Questions

Multiple choice
  1. 76543210

  2. 7654321

  3. 7654321 - 1

  4. Infinite loop

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

First printf() will print 7, then if condition gets true due to non-zero integer and t will decrement and main() call recursively. Again printf() will print 6, then if condition gets true due to non zero integer and t will decrement and main() call recursively and so on. If condition gets false, when value of t will be 0. Hence, output will be 76543210. (The static variable always retains its value)

Multiple choice
  1. 922

  2. 32767

  3. 923

  4. 999

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The sum from 0 to 922 is 32287. If 923 is added with 32287, the sum will be 33210, which is outside the range of integer data type. Hence, n up to 922 can give the desired output.

Multiple choice
  1. Compile error

  2. Linker error

  3. No error

  4. Runtime error

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

It runs properly if the message is to be typed as it is in the scanf() statement, and then enter the values of t and c. For example, After running the program: Enter the values of t and c = 45 67 The output will be t = 45 c = 67