Computer Knowledge

Programming Output Evaluation

1,953 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. character, conversion specifications and escape sequences

  2. character, integers and floats

  3. strings, integers and escape sequences

  4. none of these

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

The format string in printf() can contain ordinary characters (which are printed), conversion specifications (starting with %), and escape sequences (like \n).

Multiple choice
  1. 22

  2. 11

  3. 12

  4. compile error

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

Post increment effect only comes in the next statement. so first printf will print1 and in the next printf, only 2 will be printed. So12 will be displayed on screen.Hence, this is the answer.

Multiple choice
  1. 1

  2. 2

  3. 3

  4. garbage value

  5. compile error

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

The operands to comma operator are evaluated from left to right and we also know that assignment operator takes precedence over comma operator so first x=1 is evaluated and then x =2,3 is evaluated. Hence output would be 1

Multiple choice
  1. Spaces are ignored and tabs have meanings.

  2. Both spaces and tabs have meanings

  3. Tabs are ignored and spaces have meaning

  4. Both spaces and tabs are ignored.

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

C is a free-form language. Aside from within string literals or character constants, the compiler ignores whitespace, including spaces, tabs, and newlines, treating them as separators.