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
  1. Compilation Error

  2. Runtime error

  3. Nothing will be printed as output

  4. 5

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

Variables declared with the 'var' keyword in JavaScript are function-scoped rather than block-scoped. Because 'var a' is declared inside the function 'geek', it is accessible anywhere within that function, even outside the 'if' block where it was defined.

Multiple choice
  1. Floating point numbers between 0 and 3.

  2. Integers between 0 and 2.

  3. Integers between 0 and 3.

  4. Doubles from 0 to 3, including 0 but not including 3.

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

Math.random() returns a double value greater than or equal to 0.0 and strictly less than 1.0. Multiplying this by 3 yields a value in the range [0.0, 3.0), and casting this result to an integer truncates the decimal portion, resulting in the integers 0, 1, or 2.

Multiple choice
  1. public static final void foo;

  2. public static final int USERS = 20;

  3. public FINAL SIZE = 10;

  4. public static boolean final BORED = TRUE;

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

A valid constant declaration in Java requires a visibility modifier, the static and final keywords, a data type, an identifier, and an initial value. Option B correctly follows this structure: 'public static final int USERS = 20;'. Option D is incorrect because 'final' must precede the data type, and 'TRUE' is not a valid boolean literal.