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. 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. d.) Will have values “TRUE” or “FALSE”

  2. c.) Will have values “YES” or “NO”

  3. b.) This variable appears in output dataset

  4. a.) Can be used in assignments/calculation in datastep.

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

The automatic SAS variable _ERROR_ is a numeric flag (0 or 1) that does not appear in the output dataset. However, like other automatic variables, it can be used in data step calculations and assignments.

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.

Multiple choice technology programming languages
  1. char *gcvt(double value,int digit,char buf);

  2. char *gcvt(double value,int digit,char *buf);

  3. char *gcvt(double value,int digit,char *buf)

  4. char *gcvt(double value,int digit,char buf)

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

The standard C function gcvt converts a double-precision floating-point number to a string and stores it in a buffer. Its prototype requires a character pointer char *buf to store the string, and a semicolon at the end of the declaration.

Multiple choice technology programming languages
  1. True

  2. False

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

The SUM statement and the SUM function+RETAIN combination are functionally equivalent. Both initialize the variable, retain its value across iterations, and add the expression value. The SUM statement 'variable+expression;' is shorthand for the two-statement form shown, making this statement True.

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 (warning conditions), Error (error events), and Fatal (critical failures). This level progression allows developers to control log verbosity and focus on issues of varying severity. The option with six levels is incorrect - debug and info are not part of this API's logging hierarchy.

Multiple choice technology mainframe
  1. never

  2. if A is equal to B

  3. if A is different from B

  4. always

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

In COBOL, the period (.) terminates the scope of the IF-THEN-ELSE statement. Since instruction-3 follows the period ending the ELSE clause, it is outside the conditional logic. Consequently, instruction-3 is executed unconditionally, meaning it will always run regardless of whether variable A is equal to B or not.

Multiple choice technology
  1. True

  2. False

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

When objects are dragged from the Library and dropped into other objects or the main design area, Dialogue automatically creates a reference to that object rather than copying it. This reference-based approach allows changes to the original library object to propagate to all instances where it's used, maintaining consistency across the design.

Multiple choice technology mainframe
  1. Infinite loop

  2. logical error

  3. runtime error

  4. All of the above

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

All three error types are possible within a COBOL IF statement: infinite loops (if logic never terminates), logical errors (incorrect condition logic), and runtime errors (invalid data access during condition evaluation). Therefore 'All of the above' is correct.