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 mainframe
  1. Link option is AMODE=24 and RMODE=ANY. Compile option should have SIZE(MAX).

  2. Link option is AMODE=31 and RMODE=31. Compile option should not have SIZE(MAX).

  3. Link option is AMODE=24 and RMODE=24. Compile option should not have SIZE(MAX).

  4. Link option is AMODE=31 and RMODE=ANY. Compile option should not have SIZE(MAX).

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

To execute programs above the 16 MB line in mainframe systems, you need AMODE=31 (31-bit addressing mode) with RMODE=ANY (allow any residency mode), and avoid SIZE(MAX) compile option. Option A is wrong because AMODE=24 limits to below the line. Option B incorrectly specifies RMODE=31 instead of ANY. Option C is wrong because AMODE=24 is for below-line programs.

Multiple choice technology mainframe
  1. 10

  2. 11

  3. 9

  4. infinite Loop

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

The variable ws-var is defined as PIC 9(1), which can only hold single-digit values (0-9). The PERFORM increments ws-var from 1 by 1 until ws-var > 10. When ws-var goes from 9 to 10, the PIC 9(1) truncates 10 to 0, then continues cycling 0-1-2-...-9-0 forever, never reaching >10. This creates an infinite loop.

Multiple choice technology mainframe
  1. True

  2. False

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

A mapset can contain multiple maps, not just one. A single mapset is a collection of one or more maps that are logically grouped together and loaded together into CICS. This allows related screens to be organized and maintained as a unit.

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 programming languages
  1. A

  2. B

  3. Both

  4. None of these

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

Option B Float.isNan(x) is the correct approach for checking NaN. Option A x == Float.NaN is always false because NaN is not equal to anything including itself (IEEE 754 rule). Option C depends on MyObject's equals implementation - most objects won't handle NaN comparison correctly. B is the only valid answer.

Multiple choice technology testing
  1. Wait

  2. Exist

  3. Both A & B

  4. None

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

Both Wait and Exist statements can instruct QTP to wait for an object. The Wait statement pauses execution for a specified time, while Exist checks if an object exists and can be used in a loop to wait for the object to appear. Both achieve the goal of waiting until an object exists.