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 mainframe
  1. By using HANDLE ABEND

  2. By using HANDLE CONDITION

  3. By using ABEND

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. By writing an ALC exception handling routine

  2. With the RESP clause or HANDLE instructions.

  3. Calling the CICS Error Handler

  4. Via a call back routine.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. Entry will enter the main program and execute it.

  2. Specifies the program entry.

  3. It establishes an alternate entry point into a COBOL called subprogram.

  4. ENTRY is not a COBOL keyword

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. Invalid Syntax

  2. Specifies the end of a called program and returns control to the calling program.

  3. Specifies the end of a called program.

  4. Specifies the end of a calling program.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. Loop the program

  2. What is RECURSIVE?

  3. Recursively reenters

  4. Recursively reenters only for CICS program

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. It marks the end of certain Procedure Division statements.

  2. It marks the end of certain looping condition statements.

  3. It marks the end of program.

  4. There is nothing like EXPLICIT SCOPE TERMINATOR in COBOL

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. x as integer and y as integer.

  2. x as variant and y as integer.

  3. x as integer and y as variant.

  4. x as double and y as integer.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. 1

  2. 2

  3. 3

  4. 0

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Syntax Errors

  2. System Errors

  3. Runtime Errors

  4. Logic Errors

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.