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. 1

  2. 2

  3. 3

  4. 4

  5. 5

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

The loops store ctr values in transposed index order: myArray[j][i] where i is outer (0-2) and j is inner (0-1). After all iterations: myArray[0]=[0,2,4], myArray[1]=[1,3,5]. Therefore myArray[1][2] equals 5. The 2x3 array is filled column-wise due to swapped indices.

Multiple choice
  1. Hello ItalyHello Paris

  2. Hello Paris

  3. Bye Hello ItalyHello Paris

  4. Compiler Error

  5. Run time exception

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

This is the correct answer.

Multiple choice
  1. ByeHello ItalyHello ParisHello London

  2. Hello ItalyHello ParisHello London

  3. Hello ParisHello London

  4. Hello London

  5. Compiler error

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

This is the correct answer.

Multiple choice
  1. Equal

  2. Not equal

  3. Blank output

  4. Error at line 1

  5. Run time error

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

This is the correct answer.

Multiple choice
  1. Hello ItalyHello ParisHello London

  2. Bye

  3. ByeHello ItalyHello ParisHello London

  4. Hello ParisHello London

  5. Error at line 1

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

This is the correct answer.

Multiple choice
  1. 10, 20, 30

  2. 10, 20, 30, 40

  3. 10, 20, 30, 40, 50

  4. None of the above

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

A very simple concept has been used in this program, i.e. name of array basically contains base address and here we are initializing pointer to base address and then setting and incrementing pointer. Therefore, the correct answer is 10, 20, 30, 40, 50. 

Multiple choice
  1. Infinite loop

  2. 1 to 32767 and then from -32768 to -1

  3. Compiler error

  4. Print from 1 to 99

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

Let Initial value be: i It does not affect any thing in the program. Checking condition: ++i It is incrementing the value of i by one in each iteration.  We know in c, zero means false. When value of i is zero, loop will terminate. Increment value: i >= 99 It is not incrementing the value of variable i.

It is clear, loop will terminate when value of variable i is zero. Hence, printf function will print: 1 to 32767 and then, from -32768 to -1   (range of short int) Hence, this option is correct.