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. A new color will be created.

  2. runtime Exception

  3. Parameters are not enough

  4. Compile time error : Cannot find method color

  5. Compile time error : Color is Abstract, cannot create an object.

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

This is the correct answer because color constructor creates a new colour but it takes parameters in the range 0-255. But here the value passed is 284(in first parameter). So, a runtime exception named “IllegalArgumentException” will be thrown by the JVM. So, this is the correct answer.

Multiple choice
  1. Value of x=10Value of x=20Value of x=30

  2. Value of x=30Value of x=20Value of x=10

  3. Value of x=10Value of x=30Value of x=20

  4. Value of x=30Value of x=10Value of x=20

  5. Value of x=10Value of x=20Value of x=10

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

This is the correct option as value of x is decremented by 10 in each iteration and when value of x becomes equal to 10 when it is further decremented by 10 then the condition specified in the while statement becomes true and there would not be execution of printf() statement.

Multiple choice
  1. Infinite loop will be generated.

  2. value of i=10

  3. i=6

  4. Printf() statement would not be executed.

  5. Syntax error in the program.

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

This is the correct option as in the statement initialization, condition and increment statements are not present and in the absence of these statements infinite loop is generated.

Multiple choice
  1. value of i=1value of i=2value of i=3value of i=4

  2. Value of i=1value of i=2value of i=3value of i=4value of i=5

  3. Value of i=1value of i=4

  4. Value of i=1value of i=5

  5. Value of i=1value of i=3value of i=4

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

This is the correct output of the 'C' statement as in the while statement until the condition becomes false the value of 'i' will be printed on the screen.

Multiple choice
  1. Number is ZeroNumber is One

  2. Number is OneNumber is Two

  3. Number is ZeroNumber is Two

  4. Number is OneNumber is Zero

  5. Number is TwoNumber is One

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

This is the correct option as 'i' is incremented to 2 after each iteration.

Multiple choice
  1. 68

  2. D

  3. 6

  4. wrong statement

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

The put() function is used to display the character on the screen. If 68 will be passed, then it displays the D character whose ASCII value is 68.