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. a=2 a=2 a=2

  2. a=2 a=6 a=2

  3. a=2 a=6 a=6

  4. none of these

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

C passes arguments by value, so when 'modify(a)' is called, only the value of a (which is 2) is copied to the function. Inside modify(), the parameter a becomes 6 (2×3), but this change is local to the function and doesn't affect the original variable in main(). The printf statements show: a=2 (first), a=6 (inside modify), a=2 (back in main).

Multiple choice
  1. 1 5 9

  2. 4 8 12

  3. 1 4 7 10

  4. 1 3 6 9 12

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

The code has multiple errors: it declares 'num' but uses 'z' in the comparison, and uses HTML entities (<) instead of operators. If we assume it meant to use 'num' and proper '<' operators, each iteration finds the minimum value in a row. Row 0 minimum is 1, row 1 minimum is 5, row 2 minimum is 9, so output would be '1 5 9'.

Multiple choice
  1. Winter Autumn

  2. Autumn

  3. Summer Autumn

  4. Winter

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

Tracing the nested conditions with p=10, q=20, r=30: First if (p>10)||(q<30) evaluates to (false)||(false) = false, so we skip to the final cout statement and print 'Autumn'. The inner if-else blocks are never executed.