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 technology programming languages
  1. HELLO

  2. ELLO

  3. LLO

  4. LO

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

Pointer arithmetic moves the pointer 3 characters forward from H-E-L-L-O, so it points to L-L-O. The printf outputs from that position, printing LO. Options A, B, and C are incorrect pointer offsets.

Multiple choice technology programming languages
  1. Prints "ABC" and throws AssertionError

  2. Prints "ABC" and throws AssertionException

  3. Prints "ABC" and exits without any error

  4. Compilation error

  5. Run time exception

  6. None of the above

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

The code has a compilation error because the default case uses assert false without a proper expression. In Java, assert requires a boolean expression or a boolean expression with a string message. The syntax assert false: is incomplete.

Multiple choice technology programming languages
  1. 1

  2. two

  3. NumberFormatException

  4. ArrayIndexOutOfBoundsException

  5. Code does not compile

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

args[1] is two, parsing it gives k=2, then args[2] is 3. But Integer.parseInt(args[1]) tries to parse two as an integer, which throws NumberFormatException before any array access happens.

Multiple choice technology programming languages
  1. Compile-time error

  2. Runtime error

  3. No output

  4. None of these

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

The code compiles fine since MyThread properly extends Thread. Starting a thread without overriding run() causes it to complete immediately with no output. Thread's default run() is empty.

Multiple choice technology programming languages
  1. Prints "hello123"

  2. Prints "HELLO123"

  3. Compiler error

  4. IllegalFormatException

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

The %S format specifier in Java's Formatter class converts the string to uppercase. The format() method modifies the Formatter's internal content, and println(f) outputs the formatted result 'HELLO123'.

Multiple choice technology programming languages
  1. Prints "truetruetrue"

  2. Prints "falsefalsetrue"

  3. Prints "falsefalsefalse"

  4. Compiler error on line 5

  5. Compiler error on line 7

  6. None

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

Float.equals(Double) returns false because they're different types (Float vs Double). s1==s2 returns false because they're different StringBuffer objects. s1.equals(s2) returns true because StringBuffer.equals() compares content. Result: 'falsefalsetrue'.