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. in-line PERFORMS

  2. EVALUATE

  3. IF

  4. all

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

Scope terminators (like END-PERFORM, END-EVALUATE) are mandatory for in-line PERFORMs and EVALUATE statements to clearly delimit the statement block. They are optional (not mandatory) for IF statements, though recommended for clarity. 'all' is incorrect.

Multiple choice technology web technology
  1. a. It misses catch block and gives compile time error

  2. b. It misses catch block and give run time excpetion

  3. c. Code above compiles successfully

  4. d. Placement of finally block is not proper

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

Java allows try-finally blocks without a catch clause - this is valid syntax. The finally block executes regardless of whether an exception occurs, making it useful for resource cleanup. A catch block is only required if you want to handle specific exceptions.

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.