Computer Knowledge

Programming Fundamentals

2,611 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 programming languages
  1. bless

  2. createobject

  3. create_object

  4. blessed

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

The bless function is Perl's object constructor mechanism - it associates a reference with a package/class, creating an object. Functions like createobject or create_object don't exist in Perl's OOP system. blessed is not a keyword (though exists() can check if something is blessed).

Multiple choice technology programming languages
  1. DESTROY

  2. AUTOHANDLE

  3. AUTOLOAD

  4. AUTOLOADER

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

AUTOLOAD is a special subroutine in Perl that gets called when an undefined subroutine is invoked. This enables dynamic method generation and graceful handling of missing methods. DESTROY (option A) is for object cleanup, and AUTOHANDLE/AUTOLOADER don't exist as special subroutines.

Multiple choice technology programming languages
  1. sub test;

  2. sub test {};

  3. sub test[];

  4. none of the above

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

Forward declarations in Perl use the syntax "sub subroutine_name;" - the semicolon without a body indicates this is a declaration, not a definition. Option B with {} is a full definition with an empty body, and option C with [] is invalid syntax.

Multiple choice technology programming languages
  1. strict

  2. warning

  3. switch

  4. integer

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

In program module terminology, 'switch' is a control flow statement, not a modular program unit. 'strict' and 'warning' are compiler directives or keywords in some languages, and 'integer' is a data type. However, the question's terminology is unclear across programming languages.

Multiple choice technology programming languages
  1. REWRITE

  2. WRITE

  3. START

  4. READ

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

For sequentially accessed relative files, REWRITE does not use the INVALID KEY phrase because REWRITE in sequential mode operates on the last record read and doesn't involve key lookup. WRITE, START, and READ can all trigger INVALID KEY conditions in sequential relative file processing when key-related issues occur.

Multiple choice technology web technology
  1. True

  2. False

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

The RequestProcessor class (which handles processing) uses the Template Method pattern. It defines the skeleton of request processing in methods like processPreprocess(), processPopulate(), etc., with hooks for subclasses to override specific steps while maintaining the overall algorithm structure.

Multiple choice technology programming languages
  1. True

  2. False

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

Java DOES support pass-by-reference in a limited sense - object references are passed by value. When you pass an object reference, you can modify the object's contents but cannot make the reference point to a different object. The claim that Java 'does not support pass by reference only pass by value' is therefore false - it's more nuanced.

Multiple choice technology programming languages
  1. True

  2. False

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

Java only supports variables defined within a class or method scope. Variables defined at the class level with static act similarly to global variables but are still scoped within their class, meaning Java does not have true global variables.

Multiple choice technology programming languages
  1. True

  2. False

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

In Java array syntax, int[] a, b[] declares 'a' as a 1D int array and 'b' as a 2D int array. However, int a[], b[] declares BOTH 'a' and 'b' as 1D int arrays. The brackets bind differently: in the first form, brackets apply only to the immediately preceding variable; in the second form, they apply to all variables in that declaration. This tests understanding of Java's mixed array declaration syntax.

Multiple choice technology web technology
  1. NaN

  2. null

  3. string

  4. None of the above

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

The first typeof evaluates the type of null, which is "object". Applying typeof again to that string yields "string". Hence the final result is the string "string", which is correctly marked as the true option. The other choices do not match the double‑typeof evaluation.

Multiple choice technology mainframe
  1. Identifies the source of the JCL commands

  2. Points to the system software library

  3. Marks the beginning of the in-stream JCL

  4. Identifies the libraries that the system will search for include groups or procedures named in EXEC statements

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

The //JCLLIB statement specifies the private libraries (partitioned data sets) that the z/OS system searches to locate include groups or cataloged procedures invoked by EXEC statements within the job. It overrides or supplements default system procedure libraries (like SYS1.PROCLIB) for the scope of the job.