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. {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. 10, 3

  2. 31, 3

  3. 27, 7

  4. None of the above

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

Here, we are passing the variables by call by reference. This means that the changes that we will make in the parameter would be reflected in the passed argument. Here, the first variable passed in the function func1 (i.e., y) points to the address of the variable x. Similarly, the second variable passed in the function func1 (i.e., x) points to the address of the variable y and the third variable passed in the function func1 (i.e., x) points to the address of the variable z.

So, we have y = y + 4 ⇒ y = 10 + 4 = 14 and z = x + y + z ⇒ z = 14 + 14 + 3 = 31 z will be returned to x. So, x = 31 and y will remain 3.

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