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

  2. 20.00

  3. No output

  4. Error

  5. 20

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

In main function, definition of func() is not know to the compiler during compilation so it will assume the return type and parameter type to int,  but in definition when it sees the parameter type is float, it throws an error.

Multiple choice
  1. {mm $\ge$ n, ($\ge$i)[m=i!] }
  2. {mm $\ge$ n, ($\exists $i)[m=i2]}
  3. {mm $\le $ n, m is prime}
  4. { }

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

 

Multiple choice
  1. $val(j)=\Theta(\log n)$
  2. $val(j)=\Theta (\sqrt{n})$
  3. $val(j)=\Theta( n)$
  4. $val(j)=\Theta (n\log n)$
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

$j = n/2+n/4+n/2+\ldots +1$

number of iteration will be $2^k = n$ or $k = \log n$

this is in GP find sum till $\log n $,= $\Theta(n)$

Multiple choice
  1. S1

  2. S2 and S3

  3. S2 and S4

  4. S2 and S5

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

Multiple choice
  1. T (n) = O($\sqrt n$) and T (n) =$\Omega$($\sqrt n$)
  2. T (n) = O($\sqrt n$) and T (n) = $\Omega$ (1)
  3. T (n) = O(n) and T (n) = $\Omega$ ($\sqrt n$)
  4. None of the above

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

Multiple choice
  1. Compilation Error

  2. Hello will be printed only once.

  3. Hello will not be printed even once.

  4. Hello will be printed infinite number of times.

  5. Runtime error

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

Since the for loop has no initialisation and condition, the loop will run infinitely. The message 'Hello' will be printed infinite number of times.

Multiple choice
  1. 2 2

  2. 2 4

  3. 4 4

  4. Null

  5. It will not compile.

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

The method in the class Demo1 will be called twice, as new keyword is used for method hiding of the child class.

Multiple choice
  1. Compilation error due to invalid cast of Object to String.

  2. Compilation error due to invalid cast of String to Object.

  3. Welcome

  4. Null

  5. Exception is possible.

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

Correct output as it is a valid conversion for Object class.