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

  2. RETURN

  3. ITERATE

  4. SIGNAL

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

In REXX, the RETURN instruction is used to exit a subroutine or function and return control to the caller. EXIT terminates the entire program, ITERATE continues a loop iteration, and SIGNAL transfers control to a labeled statement. RETURN is specifically designed for subroutine/function exit.

Multiple choice technology programming languages
  1. strtod()

  2. srttoi()

  3. atoi()

  4. None of these

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

atoi() is the standard C library function that converts a string representation of an integer to its int value. strtod() converts to double, srttoi() is a typo (likely meant strtol), and atoi is correct.

Multiple choice technology programming languages
  1. True

  2. False

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

The nested loop structure has a definite termination condition (i<5) and no modification to loop variables that would prevent termination. The outer loop runs i from 0 to 4, the inner loop has a fixed range, and both loops increment properly. This code will definitely terminate after a finite number of iterations - it does NOT go into an infinite loop.

Multiple choice technology mainframe
  1. Linkage variables

  2. Parameters

  3. Control libraries

  4. Includes

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

In JCL (Job Control Language), the specific values that appear after keywords on statements are called parameters. These parameters (like USER, CLASS, MSGLEVEL, etc.) control how the job and its steps execute. Each parameter can have specific values that modify the behavior of the statement.

Multiple choice technology programming languages
  1. VAR statement

  2. VARNUM Option

  3. Variables Statement

  4. all of the above

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

The VAR statement in PROC PRINT controls variable display order. VARNUM is not a valid SAS option, and there is no 'Variables Statement' in PROC PRINT. The VAR statement is the correct and only way to specify variable order in printed output.

Multiple choice technology mainframe
  1. No , we can't check the return code for internal sort however for external sort it can be done

  2. YES,by using SORT-RETURN special register

  3. YES, we can test via Run jcl.

  4. YES,by checking in listing of the proram

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

SORT-RETURN is a special register in COBOL that automatically contains the return code from SORT or MERGE operations. After an internal SORT completes, check SORT-RETURN to determine if the operation succeeded (typically 0) or failed (non-zero). External sorts also set this register, contrary to option A's claim.

Multiple choice technology mainframe
  1. NO ERROR but offcourse the result will differ.

  2. syntax error will occur

  3. Run time error

  4. NO ERROR with same result

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

Applying the distributive law of multiplication over addition, summing the items first and then multiplying the total by the discount yields the exact same mathematical result as multiplying each item individually.

Multiple choice technology mainframe
  1. O/P PROCEDUE and INPUT PROCEDURE both

  2. O/P PROCEDUE but not INPUT PROCEDURE

  3. INPUT PROCEDURE but not O/P PROCEDUE

  4. can't use both of them

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

In COBOL, the MERGE statement can specify an OUTPUT PROCEDURE to process merged records, but it does not support an INPUT PROCEDURE because input files must already be sorted.

Multiple choice technology programming languages
  1. 1 and 4

  2. 1

  3. 2 and 3

  4. 3 and 4

  5. no error

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

Line 1 fails because a double literal (4.5) cannot be implicitly assigned to a float without an 'f' suffix. Line 4 fails because a short cannot be implicitly assigned to a char due to range differences.

Multiple choice technology platforms and products
  1. the value keeps refreshing after some intervals of time

  2. the value is made thread safe automatically

  3. the value is not cached by the compiler for the purpose of optimization

  4. to make the value of a variable to be refreshed, everytime it is accessed

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

The volatile keyword in Java indicates that a variable may be modified by multiple threads. It prevents the compiler from caching the variable in CPU registers, ensuring reads and writes go directly to main memory for visibility. However, volatile does NOT provide full thread safety - compound actions still need synchronization.