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
-
bless
-
createobject
-
create_object
-
blessed
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).
-
DESTROY
-
AUTOHANDLE
-
AUTOLOAD
-
AUTOLOADER
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.
B
Correct answer
Explanation
BEGIN blocks execute at compile time in Perl, before most of the script is parsed. This makes them ideal for initialization tasks like loading modules. END blocks run at program termination, CHECK runs after compilation but before execution, and INIT runs at the start of execution.
-
warnings
-
strict
-
5.10.1
-
constant
-
sub test;
-
sub test {};
-
sub test[];
-
none of the above
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.
-
strict
-
warning
-
switch
-
integer
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.
-
REWRITE
-
INSERT
-
DELETE
-
START
B
Correct answer
Explanation
In COBOL PROCEDURE DIVISION, REWRITE, DELETE, and START are standard verbs for file operations. INSERT is not a COBOL verb - it's an SQL statement used in database contexts, not in native COBOL file handling.
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.
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.
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.
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.
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.
-
false
-
true
-
none of the above
-
All of the above
B
Correct answer
Explanation
In JavaScript, null and undefined are loosely equal (== returns true) but strictly equal (=== returns false). This is because they represent different concepts but both represent 'empty' or 'absent' values.
-
NaN
-
null
-
string
-
None of the above
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.
-
Identifies the source of the JCL commands
-
Points to the system software library
-
Marks the beginning of the in-stream JCL
-
Identifies the libraries that the system will search for include groups or procedures named in EXEC statements
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.