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. Garbage value

    • 32767 4
    • 32768 0
    • 32767 3
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Range of int is -32768 to +32767. Value of m exceeds the limit of int. So after 32767, it goes to the other side of the range and 32769 will convert to -32767. Range of unsigned int is 0 to 65535. Value of n exceeds the limit of int. So after 65535, it goes to the other side of the range and 65535 will convert to 4.

Multiple choice
  1. Compile time error

  2. Run time error

  3. Exception error

  4. JAVA

  5. 0

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

Correct! Because of JVM always execute instruction on the basis of priority so static block has higher priority than main method hence It will execute static block then after it will go to main method (which is essential for all the java programs to run) but here programmer written intelligently his program to get output.

Multiple choice
  1. 0

  2. 1

  3. 2

  4. Compilation fails

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

A default no-args constructor is not created because there is a constructor supplied that has an argument, line 4. Therefore the sub-class constructor must explicitly make a call to the super class constructor:

Multiple choice
  1. The value of i will be 4 and the value of ch will be ’s’.

  2. The value of i will be 3 and the value of ch will be ’h’.

  3. The value of i will be 3 and the value of ch will be ’s’.

  4. The value of i will be 4 and the value of ch will be ’h’.

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

The index of character ‘e’ is 3 because the index is starting from 0. The character at position 5 is ‘h'.

Multiple choice
  1. slip stream

  2. slipstream stream

  3. stream slip stream

  4. slipstream slip stream

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

When the fix() method is first entered, start()'s s1 and fix()'s s1 reference variables both refer to the same String object (with a value of "slip"). Fix()'s s1 is reassigned to a new object that is created when the concatenation occurs (this second String object has a value of "slipstream"). When the program returns to start(), another String object is created, referred to by s2 and with a value of "stream".

Multiple choice
  1. compile time error

  2. run time error

  3. execute successfully with no output

  4. prints In Base Class

  5. none of these

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

When we run stand alone java program, the main method of that class is called. If main method is not present in that class, java runtime system calls the inherited method from parent class.