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. An exception is thrown at runtime

  2. Compilation fails because of an error in line 7

  3. Compilation fails because of an error in line 4.

  4. Compilation succeeds and no runtime errors with class A occur

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

Java methods are distinguished by their signature (name and parameter types), not by return type. Lines 3 and 4 declare two doit() methods with identical signatures but different return types (void vs String), which causes compilation failure. Line 7 is valid overloading because the parameter differs.

Multiple choice technology web technology
  1. Compile error

  2. printf("What this will print")

  3. What this will print

  4. 20

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

The inner printf prints the string and returns the number of characters printed (20). The outer printf then prints this return value as an integer. So the full output is 'What this will print20' on the same line, and the outer printf displays 20.

Multiple choice technology programming languages
  1. x=57 & y=94

  2. x=57,y=55

  3. X = 57 Y= 93

  4. X = 37 Y= 65

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

Trace the operations: x=20, y=35. First, 'x = y++ + x++' uses original values (35+20=55), then post-increments happen (y→36, x→56). Second, 'y = ++y + ++x' pre-increments first (y→37, x→57), then adds (37+57=94). Final output is x=57, y=94.

Multiple choice technology enterprise content management
  1. Initial Value, New 1, Initial Value

  2. Initial Value, New 1, New 1

  3. Initial Value, New 1, Line 7 will result in a Runtime error

  4. Compilation Error due to Line 7 ( Duplicate Loading )

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

Line 4 writes 'Initial Value' because loadById retrieves the current value. Line 6 writes 'New 1' because test.text was modified. Line 8 writes 'Initial Value' because test1 is a NEW WebObject instance that loads the original data - it doesn't share the reference with 'test'. The key insight is that loadById retrieves fresh data, it doesn't create a shared reference.

Multiple choice technology enterprise content management
  1. Compilation Error, Postive value expected.

  2. Runtime Error, Postive value expected

  3. lo world

  4. lo worl

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

The slice(start, end) method extracts up to but not including end. A negative index counts from the end of the string. For "Hello World" (length 11), -1 refers to 'd'. Slicing from 3 to 10 yields "lo Worl".