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 databases
  1. CREATE OR REPLACE PROCEDURE <<Procedure name>> as

  2. CREATE OR REPLACE PROCEDURE <<Procedure name>>(Parameter list) as

  3. CREATE OR REPLACE PROCEDURE <<Procedure name>> is

  4. All of the above

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

Oracle PL/SQL procedure creation requires either AS or IS keyword after the procedure name. Parameter lists are optional. Both CREATE OR REPLACE PROCEDURE name AS and CREATE OR REPLACE PROCEDURE name IS are valid syntax. Adding a parameter list before AS/IS is also valid when parameters are needed.

Multiple choice technology security
  1. Trace, warn, error and fatal

  2. Trace, debug, info, warn, error and fatal

  3. Debug, info, error, fatal

  4. Debug, Warn, Error

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

The API provides four logging levels: Trace, warn, error, and fatal. Option B incorrectly includes debug and info which are not in this API. Options C and D are missing levels from the actual set.

Multiple choice technology security
  1. Trace, warn, error and fatal

  2. Trace, debug, info, warn, error and fatal

  3. Debug, info, error, fatal

  4. Debug, Warn, Error

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

The security API provides four logging levels: trace (most detailed), warn (warnings), error (errors), and fatal (critical failures). Option B lists six levels commonly found in general logging frameworks, but this specific security API implements a simpler four-level model.

Multiple choice technology programming languages
  1. Mulitplying by 2*n and Dividing by 2*n

  2. Dividing by 2*n and Multiplying by 2*n

  3. Multiplying by n and Dividing by n

  4. Dividing by n and Multiplying by n

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

Left shifting by n bits multiplies by 2^n (each position shift is a power of 2). Right shifting divides by 2^n. This is fundamental to binary arithmetic.

Multiple choice technology programming languages
  1. True

  2. False

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

In Perl, code is NOT placed in a package called 'main' by default. The 'main' package exists as a special package for main program scope, but package declarations are explicit. Without a package declaration, code compiles in the current package (which may be 'main' initially but isn't automatically enforced as a container). Perl's default behavior differs from some other languages.

Multiple choice technology mainframe
  1. True

  2. False

  3. can't say

  4. none

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

COBOL does NOT require statements to start on a fresh line. Multiple statements can be written on the same line, separated by appropriate delimiters or scope terminators. This flexibility is different from some modern languages where line breaks are syntactically significant.

Multiple choice technology mainframe
  1. REPEAT 6 TIMES <n> instruction <n> END-REPEAT

  2. MOVE 1 TO COUNTER <n> PERFORM UNTIL COUNTER = 6 <n> COMPUTE COUNTER = COUNTER + 1 <n> instruction <n> END-PERFORM

  3. PERFORM 6 TIMES <n> instruction <n> END-PERFORM

  4. REPEAT VARYING COUNTER FROM 1 BY 1 UNTIL COUNTER = 6 <n> instruction <n> END-PERFORM

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

The correct COBOL syntax for repeating an instruction a fixed number of times is 'PERFORM n TIMES' followed by the instruction and 'END-PERFORM'. Option A uses REPEAT which is not standard COBOL. Option B incorrectly computes counter outside the loop. Option D incorrectly uses REPEAT with VARYING syntax.

Multiple choice technology mainframe
  1. after each 01 level of a variable declaration

  2. at the end of each instruction

  3. at the end of each paragraph

  4. at the end of the program

  5. to end an IF instruction

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

In COBOL, a period is mandatory to terminate 01-level entries (A), end each paragraph (C), and end the program (D). It is NOT required after each instruction (B) - statements can be chained. It is NOT required to end IF (E) - IF uses END-IF or explicit scope in modern COBOL, not period termination.

Multiple choice technology mainframe
  1. A B Z E F Z X

  2. A B X Z E F G H Z X

  3. A B X Z G H X

  4. A B X Z G H Z

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

Execution follows: MAIN-PAR calls INIT-PAR (A, B, then PERFORM READ-X executes X), then PERFORM LOOP-PAR (but LOOP-PAR is never defined, so this might be an error - however READ-X contains X so X executes again), then PERFORM TERM-PAR (G, H), then STOP RUN (Z). Sequence: A, B, X, X, G, H, Z. However option C shows A B X Z G H X which seems inconsistent. Let me re-examine - the LOOP-PAR is never called from INIT-PAR since it only says PERFORM READ-X. So after INIT-PAR completes (A,B,X), control returns to MAIN-PAR which then does Z (PERFORM LOOP-PAR) but LOOP-PAR isn't shown... actually the option might be assuming simplified flow.

Multiple choice technology web technology
  1. Variable can store multiple value but array can not store

  2. Variable can not store multiple value but array can

  3. Both are same

  4. None of them

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

A standard scalar variable stores only a single value at any given time, whereas an array is a data structure designed to store multiple values (elements) under a single identifier.

Multiple choice technology programming languages
  1. True

  2. False

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

This is technically TRUE in modern C (C99 and later). Using #include and replacing main() with a different entry point or using certain compiler extensions allows programs without main(). However, in standard C89/C90 and traditional C education, main() is required. This question tests knowledge of C standards evolution rather than practical programming.