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

  2. v

  3. Compiler Error : cannot pass a function as a parameter

  4. Compiler Error : parameters are not sufficient

  5. Runtime error

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

This is the correct answer. S.length() wil return 15 because there are 15 characters in the String. So the code looks like this :-s.charAt(15); the index count starts at 0. In this way the last character a is at index number 14. So if we try to access "a" character in a string which is out of bounds then a runtime exception “StringOutOfBound” will be thrown. So we can pass only until s.charAt(s.length()-1).  So this is a 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.