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

  2. string

  3. gnirt

  4. no output is printed

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

Let us consider below line inside the for loop p[i] = s[length — i]; For i = 0, p[i] will be s[6 — 0] and s[6] is ‘\0′ So p[0] becomes ‘\0’. It doesn’t matter what comes in p[1], p[2]….. as P[0] will not change for i >0. Nothing is printed if we print a string with first character ‘\0′   

Multiple choice
  1. the number of leaf nodes in the tree

  2. the number of nodes in the tree

  3. the number of internal nodes in the tree

  4. the height of the tree

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

Value initialized by 0 If any root node has left child then it adds 1 to the value & move to left child & if any mode has right child also then also calculated the value using recursion & take maximum of both left & right value is taken. So we know that height is the largest distance between root node & leaf. So this program calculates heights.

Multiple choice
  1. no compile warning or error

  2. some complier-warning not leading to unitended results

  3. Some complier-warning due to type-mismatch eventually leading to unitended results

  4. Complier errors

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

Here if line 1 which is prototype declaration of the function foo, in C compilation processes this would give a compile warning, due to type-mismatch. Since then compiler won't know what the return type of foo is. So unintended results may occur

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. 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. Garbage value

    • 32767 4
    • 32768 0
    • 32767 3
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Range of int is -32768 to +32767. Value of m exceeds the limit of int. So after 32767, it goes to the other side of the range and 32769 will convert to -32767. Range of unsigned int is 0 to 65535. Value of n exceeds the limit of int. So after 65535, it goes to the other side of the range and 65535 will convert to 4.