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 technology programming languages
  1. Hallo World!

  2. Hello World!

  3. Compile time error

  4. NullPointerException

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

Strings in Java are immutable - the replace() method returns a new String object but does not modify the original. The line myString1.replace('e', 'o') creates "Hallo World!" but the result is discarded. Since myString1 is not reassigned, it still contains "Hello World!", which is printed.

Multiple choice technology programming languages
  1. Java Programming

  2. Compile time error

  3. Throws exception

  4. Java Program

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

The setLength() method truncates the StringBuffer content to the specified length. "Java Programming" has 16 characters, but setLength(12) keeps only the first 12 characters: "Java Program". The remaining 4 characters "ming" are discarded.

Multiple choice technology programming languages
  1. char* text;

  2. char *text;

  3. Char * text;

  4. char text*;

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

char* text; follows the project's pointer declaration guideline - the asterisk is attached to the type, not the variable name. The alternative char *text places space between type and asterisk, which this project's guidelines specify as incorrect.

Multiple choice technology programming languages
  1. 80

  2. 3.2

  3. 3

  4. 1

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

In this REXX code, the operator % performs integer division (not floating-point division). X=16 and Y=5, so Z = 16 % 5 = 3 (the integer quotient, ignoring the remainder). Option A (80) would be multiplication (*), and option B (3.2) would be regular division (/). REXX uses % specifically for integer division, which truncates toward zero.

Multiple choice technology web technology
  1. 8b1a9953c4611296a827abf8c47804d7

  2. 461707669

  3. f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0

  4. $23413
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The crc32() function calculates a 32-bit cyclic redundancy checksum of a string and returns it as an integer. For 'Hello world!' the output is 461707669. Options A and C are hexadecimal MD5 hashes (not CRC32), and D is not a valid crc32() output format.

Multiple choice technology programming languages
  1. Run Time Error

  2. Compiler Error

  3. StackOverflow Exception

  4. NONE

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

In VB.NET, the constructor New in Myclass is declared as Private. In the Test class, Main tries to instantiate Myclass using New Myclass(10). Because the constructor is private, it is inaccessible from outside the class, causing a compiler error.

Multiple choice technology programming languages
  1. Compilation error, attempting to perform binary comparison on logical data type.

  2. Compilation and output of "We are equal 10".

  3. Compilation and output of "Not equal! 20".

  4. Compilation and output of "Not equal! 10".

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

The code uses the && operator which short-circuits. Since b1 is false, the right side ((Output += 10) == 20) is never evaluated. Output remains 10, not 20. The condition is false, so the else block executes, printing 'Not equal! 10'. The key is understanding short-circuit evaluation with && - if the left operand is false, the right is skipped.

Multiple choice technology programming languages
  1. prints: Value is - 9

  2. prints: Value is - 5

  3. Compilation error

  4. None of these

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

In the ternary expression, since one operand is double (9.9) and the other is int (9), the int is promoted to double, evaluating the expression to 9.0. Since Value is - 9.0 is not listed, 'None of these' is correct.