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. Good Bye 1024 2048 32768

  2. 1024 2048 32768

  3. 2048 32768

  4. 32768

  5. Compilation error

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

This expression is evaluated as follows: (1024*(2^8)(2^3)) / ((2^8)/(2^3)) - (1024(2^8)*(2^3)) / ((2^8)/(2^3)) = -1024

Multiple choice
  1. 8, 2, 2

  2. 4, 4, 2

  3. 8, 4, 2

  4. Compilation error

  5. Runtime error

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

Sizeof operator is used to provide size of the given variable. Here, sizeof(7.5) provides the size 8 byte because it is a double type. Sizeof(80000) provides the size 4 byte because it is long int type. Sizeof ('B') provides the size 2 byte because it is a character type.

Multiple choice
  1. Compilation error

  2. 0, 0

  3. 65536, 0

  4. Runtime error

  5. 65536, - 10

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

In any binary operation of dissimilar data type, lower data type operand always automatically type casted into the operand of higher data type before performing the operation and result will be higher data type. x= 10 + (-10u) + 10u + (-10) x= 10 + (-10) + 10 + (-10) x=0 so y=0

Multiple choice
  1. Address, address, 3

  2. Address, address, address

  3. 3, address, address

  4. Syntax error

  5. Runtime error

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

Here, you can see that * and & always cancel to each other. &a= a. So k= &j. It prints the address. *k= *(&j). Since, k= &j. So, *k= *&j= j= &i. It prints the address. **k= *(&j)= *j= *(&i)= i =3.

Multiple choice
  1. Can not predict

  2. 12

  3. Garbage value

  4. Compiler error

  5. Semantics error

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

You can not predict the value of volatile variable because its value can be changed by any microprocessor interrupt.

Multiple choice
    • 5
  1. 4

  2. Lexical error

    • 6
  3. Syntax error

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

Char a = 260. 260 is beyond the range of signed character. Its corresponding cyclic value is -6. a = -6. Operator !, ~ and ++ have equal precedence. First ++ operator performs, so its value is -5. i = -5 + !-5 + ~5 + -5 = -5+0+4-5 = -6.