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. 1 2

  2. 1 2 3 45 6

  3. 1 2 3 4 5 6

  4. 1 2 a 3 45 6

  5. 1 2 followed by an exception

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

The Scanner processes tokens '1', '2', and then encounters 'a'. When sc.nextInt() is called to parse 'a' as an integer, it throws an InputMismatchException. Consequently, '1 2' is printed before the program terminates with an exception.

Multiple choice technology programming languages
  1. Data Hiding

  2. Data Shadowing

  3. Data Obscuring

  4. None of the Above

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

When a local variable within a block or method has the same name as a member variable in the surrounding class scope, the local variable shadows the class variable. This compiler concept is known as variable or data shadowing.

Multiple choice technology programming languages
  1. true false true false true

  2. true false false true true

  3. true false false false true

  4. true false true false false

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

String literals (s1, s2) reference the same string pool object. new String() creates distinct heap objects (s3, s4). The == operator compares references, not content. intern() returns the string pool reference, so comparisons involving intern() yield true when the content is in the pool.

Multiple choice technology testing
  1. 10 10 10

  2. 10 10 20

  3. Runtime Exception

  4. Compilation error

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

Interface variables are implicitly final and static, so they cannot be modified. The line x=x+10 attempts to reassign a final variable, causing a compilation error. The code would print 10 10 before failing on the assignment.

Multiple choice technology security
  1. Static Code Analysis is the analysis of software code by actually executing the binaries resulting from this code

  2. Static Code Analysis is the analysis of software code without actually executing the binaries resulting from this code

  3. Static Code Analysis is the analysis of executables resulting from this code

  4. None of the above

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

Static code analysis examines source code for defects, security vulnerabilities, and coding standard violations without executing the program. This is distinct from dynamic analysis, which requires running the application. Static analysis tools parse code, build abstract syntax trees, and apply rules to identify potential issues at compile time.

Multiple choice
  1. 5

  2. 15

  3. 10

  4. 25

  5. Compilation Error

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

Functions are another type of variable in JavaScript. Creating a function within another function changes the scope of the function in the same way it would change the scope of a variable.The functions defined within another function won't be accessible outside the function unless they have been attached to an object that is accessible outside the function. In the above code, we are calling the function named 'fun3()' , which in turn is calling another function named 'fun1()' with two arguments (5) and (5). The fun1() will copy the value of the first 5 to i and the second value will be copied to j. The result of fun2() will be sent to 'fun1()'. fun1() will return the result (25) to fun3(). The result will be copied to the variable 'r' and printed using an alert box.

Multiple choice
  1. Compilation Error

  2. This,is,a,sample,string

  3. This,is,a,sample,string,

  4. ,This,is,a,sample,string,

  5. T,h,i,s,i,s,a,s,a,m,p,l,e,s,t,r,i,n,g

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

The split() method is used to split a string into an array of substrings, and returns the new array. In the above code, the spaces of the string will be converted to commas (,)

Multiple choice
  1. Compilation Error.

  2. The word 'Hello' will be printed infinitely.

  3. 'Hello' will be printed only once.

  4. 'Hello' will not be printed at all.

  5. 'Hello' will print once and then program will show a runtime error.

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

The C for statement has the following form:

for(start;condition;increment/decrement)   {}

In the statement given above since, nothing has been specified the for loop, it  will run infinitely. To terminate such a loop the 'ctrl+break' key combination should be pressed.
Multiple choice
  1. Collection of values having same data type

  2. The basic element recognized by the compiler

  3. The largest individual units of program

  4. Pointers

  5. References

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

Tokens are individual words and punctuation marks in passage of text. In C, program the smallest individual units are known as C Tokens. C has Six types of Tokens - Keywords,  Strings, Identifiers, Operators, Constants and special symbols.