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
-
DSPLCK
-
DSPOBJLCK
-
DSPSYSLCK
-
DSPACTLCK
B
Correct answer
Explanation
DSPOBJLCK (Display Object Locks) is the correct IBM i command to show active locks on any object. DSPLCK is not a valid command, DSPSYSLCK would display system-level locks (not object-specific), and DSPACTLCK is not a standard command.
-
By using HANDLE ABEND
-
By using HANDLE CONDITION
-
By using ABEND
-
None of the above
A
Correct answer
Explanation
In CICS, abends (abnormal terminations) are handled using the HANDLE ABEND command, which allows a program to specify error-handling routines to execute when an abend occurs. HANDLE CONDITION is for normal condition handling, not abends specifically, and ABEND alone is not a command but an event type.
-
By writing an ALC exception handling routine
-
With the RESP clause or HANDLE instructions.
-
Calling the CICS Error Handler
-
Via a call back routine.
B
Correct answer
Explanation
CICS provides two main mechanisms for handling unusual conditions: the RESP option returns a response code that you can check after each command, and HANDLE CONDITION/ABEND commands let you specify error handling routines. Option A is non-existent terminology, while C and D are not standard CICS approaches.
B
Correct answer
Explanation
COBOL COPY statements are expanded during the PRECOMPILE stage, not the pre-compile stage. The precompiler processes COPY statements by inserting the copied text into the source program before the actual compilation begins. This is a critical distinction in the COBOL/DB2 compilation process.
-
Entry will enter the main program and execute it.
-
Specifies the program entry.
-
It establishes an alternate entry point into a COBOL called subprogram.
-
ENTRY is not a COBOL keyword
C
Correct answer
Explanation
The ENTRY statement in COBOL is used to establish an alternate entry point in a called subprogram, allowing execution to begin at a place other than the start of the Procedure Division.
-
Invalid Syntax
-
Specifies the end of a called program and returns control to the calling program.
-
Specifies the end of a called program.
-
Specifies the end of a calling program.
B
Correct answer
Explanation
The EXIT PROGRAM statement in COBOL specifies the logical end of a called subprogram and returns control back to the calling program.
-
Loop the program
-
What is RECURSIVE?
-
Recursively reenters
-
Recursively reenters only for CICS program
C
Correct answer
Explanation
The RECURSIVE clause in the PROGRAM-ID paragraph specifies that the COBOL program can be recursively reentered while an active call to it is still in progress, allowing recursive execution.
-
It marks the end of certain Procedure Division statements.
-
It marks the end of certain looping condition statements.
-
It marks the end of program.
-
There is nothing like EXPLICIT SCOPE TERMINATOR in COBOL
A
Correct answer
Explanation
Explicit scope terminators in COBOL (like END-IF, END-PERFORM) mark the end of specific Procedure Division statements. They provide clear boundaries for conditional and looping constructs, improving code readability and preventing ambiguity in nested structures.
-
x as integer and y as integer.
-
x as variant and y as integer.
-
x as integer and y as variant.
-
x as double and y as integer.
B
Correct answer
Explanation
In Visual Basic, the statement 'Dim x, y as integer' declares x as a Variant (default type) and y as Integer. The 'As Integer' type declaration only applies to the variable immediately preceding it (y), not to x. This is a common VB quirk in multiple variable declarations.
A
Correct answer
Explanation
The Timer control in Visual Basic 6.0 has exactly one primary event: the Timer event, which fires repeatedly at the interval specified by the Interval property. This single event makes the Timer control useful for creating time-based operations without multiple event handlers.
-
Syntax Errors
-
System Errors
-
Runtime Errors
-
Logic Errors
A,C,D
Correct answer
Explanation
Visual Basic has three main error categories: Syntax Errors (caught during compilation when code structure is invalid), Runtime Errors (occur during program execution like division by zero), and Logic Errors (program runs but produces incorrect results due to flawed logic). 'System Errors' is not a standard VB error classification.
A
Correct answer
Explanation
Java APIs are pre-compiled code libraries that provide ready-to-use functionality. These packages (like java.lang, java.util, java.io) contain compiled classes and methods that developers can import and use without rewriting common functionality. This is fundamental to Java's 'batteries included' approach.
-
Inside TRY Inside FINALLY
-
Inside TRY
-
Inside TRY Inside CATCH Inside FINALLY
-
None of the above
-
Long
-
Int(0)
-
Char(0)
-
Binary
C
Correct answer
Explanation
In Oracle, NULL is a special value indicating absence of data and is commonly represented as CHAR(0) in type system discussions. NULL is not Long, Int(0), or Binary.
B
Correct answer
Explanation
The anonymous PL/SQL block shown is invalid because it lacks an executable section. Even though it has the DECLARE and BEGIN/END structure, there are no statements between BEGIN and END. Oracle requires at least one executable statement (often NULL;) in the execution block. The empty execution section makes this a syntax error.