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. FINISH

  2. GO BACK

  3. STOP

  4. EXIT

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

In COBOL, GO BACK is equivalent to STOP RUN in a stand-alone program because GO BACK returns control to the calling program, and when there is no caller (stand-alone), it terminates the program. FINISH, STOP, and EXIT are not valid COBOL verbs for program termination in this context. EXIT PROGRAM exists but is for called programs, not stand-alone programs.

Multiple choice technology mainframe
  1. FINISH

  2. GO BACK

  3. STOP

  4. EXIT

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

In COBOL, the GOBACK statement is the preferred alternative to STOP RUN in stand-alone programs. GOBACK returns control to the caller and closes all files, achieving the same functionality as STOP RUN. FINISH, STOP (without RUN), and EXIT are not valid COBOL statements for program termination.

Multiple choice technology mainframe
  1. 01

  2. Will not change

  3. Will change

  4. 56

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

Using NEXT SENTENCE in COBOL transfers program control to the statement immediately following the next period. Since the period is placed after ADD +1 TO INPUT-COUNT., executing NEXT SENTENCE skips the addition step entirely, leaving INPUT-COUNT unchanged.

Multiple choice technology mainframe
  1. True

  2. False

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

When defining ASCENDING or DESCENDING KEY for table sorting or searching with SEARCH ALL, the key data items must be comparable and have a total ordering. Floating-point numbers should not be used as keys because they can have representation issues (like NaN, infinity, or precision problems) that make sorting and binary search unreliable and unpredictable.

Multiple choice technology mainframe
  1. True

  2. False

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

ASCENDING and DESCENDING keys are used for sorting and table searching operations (SORT, SEARCH ALL). Floating-point numbers are approximate values and may have tiny representation errors, making them unreliable for exact comparisons required by these operations. Therefore, floating-point items cannot be used as sort/search keys. Option A is correct.

Multiple choice technology platforms and products
  1. Static

  2. Dynamic

  3. System Session

  4. Non-System Session

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

Static variables in OBI EE are defined once in the repository and don't require initialization blocks - their values are set at design-time. Dynamic variables, system session variables, and non-system session variables all require initialization blocks to populate their values at runtime.

Multiple choice technology mainframe
  1. Yes

  2. No

  3. Platform Dependent

  4. Compile but Goes into a LOOP

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

STOP RUN is technically valid in COBOL syntax even within subroutines, though it's generally considered poor practice as it abruptly terminates the entire program unit. The question asks about technical possibility, not best practices.

Multiple choice technology mainframe
  1. 2

  2. 3

  3. 4

  4. 5

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

In COBOL, a period ('.') terminates the entire IF statement structure. In line 3, 'MOVE 200 TO VALUE-B.' has a period at the end, which prematurely terminates the outer 'IF A > B' statement. Thus, the subsequent 'END-IF' lines will cause compiler errors as they are unmatched.

Multiple choice technology platforms and products
  1. True

  2. False

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

An initial value property in Oracle Forms sets the default value for an item when a record is created, but this value can be altered programmatically using triggers like When-New-Form-Instance, When-New-Block-Instance, or When-New-Record-Instance. The statement incorrectly claims it cannot be changed.