Computer Knowledge

Programming Fundamentals

2,381 Questions

Programming fundamentals form the core logic of software development and computer science. This includes variable declarations, pointer assignments, loop iterations, and exception handling. These technical topics are regularly tested in computer knowledge and IT officer competitive examinations.

Variables and arraysPointer assignmentsLoop iterationsException handling blocksCompile time errorsFunction references

Programming Fundamentals Questions

Multiple choice technology web technology
  1. True

  2. False

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

The finally block always executes when the try block exits, regardless of how it exits - whether through normal execution, an exception, or a return statement. The only exceptions are if the JVM exits (via System.exit()) or the thread dies. Even when return is the last statement in try, finally runs before the method actually returns.

Multiple choice technology web technology
  1. True

  2. False

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

Garbage collection only reclaims memory from objects that are no longer referenced. It does not prevent out-of-memory errors - if your program creates objects faster than GC can reclaim them, or holds onto too many live objects, it will still run out of memory. GC manages memory but doesn't guarantee unlimited availability.

Multiple choice technology databases
  1. Integer

  2. Null

  3. Object

  4. String

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

JSON has only six basic data types: string, number, boolean, null, object (array), and array. Integer is not a separate type - numbers in JSON are just "number" (which can be integer or floating-point). Null, Object, and String are valid JSON types. Note that Object here refers to JSON objects (key-value pairs), not Java objects.

Multiple choice technology databases
  1. Alert()

  2. Eval()

  3. Evale()

  4. Console()

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

JSON is a subset of JavaScript, and in early implementations, eval() was commonly used to parse JSON strings into JavaScript objects. However, this is now considered a security risk and is deprecated in favor of JSON.parse(). The question reflects historical usage patterns. eval() executes arbitrary JavaScript code, making it dangerous with untrusted JSON.

Multiple choice technology
  1. The instance gets garbage collected.

  2. The code on line 33 throws an exception

  3. The code on line 35 throws an exception.

  4. The code on line 31 throws an exception

  5. The code on line 33 executes successfully.

Reveal answer Fill a bubble to check yourself
B,C,E Correct answer
Explanation

The finally block (line 37) executes whenever control enters the try block. This happens when line 33 throws an exception (caught at line 34), when line 33 executes normally (no exception), or when line 35 throws an exception (still executes finally before exiting). Garbage collection (line 31 exceptions) don't trigger finally.

Multiple choice technology programming languages
  1. A. final

  2. C. native

  3. F. abstract

  4. G. protected

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

In interfaces, fields are implicitly public, static, and final. Valid modifiers include public, static, and final. The question asks which three are valid but only provides A (final) as correct among the options. Native, abstract, and protected are not valid for interface fields. The claimed answer A is correct, but the question asks to choose three and only one is marked correct.

Multiple choice technology platforms and products
  1. Instance Data

  2. Target Data

  3. Both

  4. None of these

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

The Informatica Debugger can debug transformations using either instance data (passing test data through) or target data (from actual target tables). This provides flexibility for testing in different scenarios. Options A and B incorrectly suggest only one mode is available.

Multiple choice technology programming languages
  1. ALLOCATE

  2. ALLOC

  3. ALLMEM

  4. LOADM

  5. None of the above

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

ALLOC is used to allocate memory at runtime in certain systems (possibly mainframe/COBOL context based on the option names). Standard memory allocation functions are malloc, calloc, realloc (C) or new (C++), but this question appears to test knowledge of a specific system's runtime allocation command. Options A, C, and D are not standard allocation commands.

Multiple choice technology programming languages
  1. It will run without error

  2. Runtime Error

  3. Compilation Error

  4. None of all

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

The Thread class has a constructor Thread(Runnable target), and Thread itself implements Runnable. Passing a Thread object as the Runnable target is valid syntax - it compiles and runs without error. The new Thread object wraps the existing Thread as its Runnable target.