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

  2. 17+3

  3. 173

  4. CompileTime Error

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

When a string is concatenated with integers using the + operator, Java evaluates left-to-right. First "The answer is: " + 17 produces "The answer is: 17". Then that string is concatenated with 3 to produce "The answer is: 173". Once a string enters the expression, all subsequent + operations perform string concatenation, not arithmetic addition.

Multiple choice technology web technology
  1. 0

  2. undefined

  3. Exception(0365): object undefined!

  4. Javascript error in the browser

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

JavaScript is case-sensitive, so 'sum' and 'Sum' are two completely different variables. The code only assigns a value to 'sum', leaving 'Sum' uninitialized. When alert(Sum) is called, it outputs 'undefined' because the variable Sum was never assigned a value.

Multiple choice technology web technology
  1. 1

  2. 11

  3. undefined

  4. null

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

JavaScript arrays are dynamic and their length is determined by the highest index plus one. When you assign a value to index 10, the array automatically expands to have a length of 11 (indices 0-10), even though only one element has an actual value.

Multiple choice technology web technology
  1. -1

  2. 4

  3. JavaScript error in the browser

  4. 5

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

The indexOf method returns the position of the first occurrence of a substring. In 'JavaScript is the best', counting starts from 0, so 'J' is at position 0 and 'S' is at position 4. The substring 'Script' starts at index 4.

Multiple choice technology web technology
  1. drizzling, but now it is heavily raining

  2. The day started drizzling, but now it is heavily raining

  3. drizzling

  4. null

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

The regex pattern /(dr.*ing)/ matches text starting with 'dr' and ending with 'ing', capturing everything in between. In the sentence, 'drizzling, but now it is heavily raining' matches this pattern (dr + izzling, but now it is heavily rain + ing). The match is stored in RegExp.$1.