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

Multiple choice technology
  1. Y

  2. N

  3. Will cause run time error

  4. Returns Empty

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

The Num() function converts an empty string to 0, which evaluates as truthy in the conditional check. In DataStage BASIC, the expression If Num(Arg1) Then 'Y' Else 'N' returns 'Y' because Num('') = 0, and 0 is treated as a valid numeric value that passes the conditional test.

Multiple choice technology programming languages
  1. The class does not compile because the top level class cannot be protected.

  2. The program prints "abc"

  3. The program prints "abcabc"

  4. The program does not compile because statement "test = test + test" is illegal.

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

In Java, a top-level class cannot have protected access. Only public or default (package-private) access are allowed for top-level classes. The protected modifier is only valid for class members (methods, fields, nested classes).

Multiple choice technology programming languages
  1. 1

  2. 2

  3. 3

  4. 4

  5. 5

  6. No errors

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

\l is not a valid Java escape sequence. Valid escapes are \b (backspace), \t (tab), \n (newline), \f (form feed), \r (carriage return), \' (single quote), \' + " (double quote), and \ (backslash). Attempting to use \l causes a compile-time error.