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 testing
  1. the use of a variable before it has been defined

  2. unreachable code

  3. memory leaks

  4. array bound violations

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

Memory leaks are a runtime phenomenon that depends on dynamic allocation and deallocation patterns during program execution. Static analysis can detect potential leaks through code inspection but cannot definitively identify actual memory leaks without runtime information. The other options are all detectable through compile-time analysis.

Multiple choice technology programming languages
  1. a

  2. b

  3. c

  4. Don't know

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

Float.isNan(x) is the correct way to check for NaN (option a has typo). Using x == Float.NaN always returns false because NaN is defined as not equal to any value including itself. Option c's correctness depends on Myobject's equals implementation, but Float's equals method correctly handles NaN.

Multiple choice technology platforms and products
  1. .NET Threading

  2. .NET Remoting

  3. .NET RMT

  4. None of the above

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

.NET Remoting enables communication between application domains, processes, or machines. It allows objects to interact across boundaries using different transport protocols and serialization formats, making distributed applications possible.

Multiple choice technology mainframe
  1. output on the terminal: result = 2 3 5

  2. output on the terminal: result = 3 2 1

  3. output on the terminal: result = var_3 var_4 var_5

  4. the program will terminate with an error

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

The REXX code has a syntax error in the IF clause: IF var_1 = var_2 uses a single equals sign, which in REXX is an assignment operator, not a comparison operator. The correct comparison would be IF var_1 == var_2. The syntax error causes the program to terminate, making option D correct.

Multiple choice technology mainframe
  1. Ia loop unconditionally and continues with the next clause after the loop

  2. IF var_1 = var_2 THEN var_1 = var_1 + a loop and EXEC unconditionally, but doesn't return to the caller of the EXEC.

  3. a loop and EXEC unconditionally, returns to the caller of the EXEC and provides a return code.

  4. a loop and EXEC unconditionally, returns to the caller of the EXEC, but doesn't provide a return code.

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

The EXIT clause in JCL terminates a loop immediately and transfers control back to the calling EXEC with a return code. This is different from a normal loop exit which would continue with the next statement after the loop. The return code allows the calling program to check if the EXEC completed successfully or encountered a condition that required early termination.

Multiple choice technology mainframe
  1. the external subroutine SUBROUT1 will be executed, bypassing any internal subroutines.

  2. the internal subroutine SUBROUT1 will be executed; external subroutines aren't called.

  3. the internal subroutines will be searched for SUBROUT1; only if there isn't an internal one, the external SUBROUT1 will be executed.

  4. an error will occur; subroutine names must never be coded between quotes.

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

In COBOL, when calling a subroutine using a literal string like CALL 'SUBROUT1', the compiler resolves this as a call to an external program or subroutine, bypassing any internal program structure.

Multiple choice technology mainframe
  1. One can not shield variables in a subroutine from the main EXEC, only from other subroutines.

  2. One can shield the variables by using the clause: CALL SUBROUT1 PROCEDURE

  3. One can shield the variables by defining the start clause of a subroutine:SUBROUT1: PROCEDURE

  4. One can shield the variables by defining the start clause of a subroutine: SUBROUT1: SHIELDED

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

Internal subroutines shield their variables from the main EXEC when defined with the PROCEDURE clause. This creates a local variable scope where variables defined inside the subroutine are not accessible to the calling EXEC. The correct syntax is SUBROUT1: PROCEDURE which defines the start of the subroutine with variable shielding.

Multiple choice technology mainframe
  1. This value must be numeric.

  2. This value can be alphanumeric.

  3. This value is stored in the system variable RC.

  4. This value is stored in the system variable RCODE.

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

When a RETURN clause is used in a subroutine, the value passed back can be alphanumeric (text or numeric). This value is returned to the calling EXEC but is not stored in RC or RCODE system variables as those are used for return codes from programs, not subroutine return values. The RETURN clause supports flexible data types.

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 statements, the fields that contain specific values to direct and control the execution are called parameters. These include positional parameters (identified by position) and keyword parameters (identified by name). They provide the specific instructions needed for statement execution.

Multiple choice technology programming languages
  1. True

  2. False

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

The statement reverses the actual relationship. CTS (Common Type System) is a component OF CLR (Common Language Runtime), not something that CLR is built into. CLR is the execution environment that includes CTS as part of its type system. The False answer correctly identifies this error.

Multiple choice technology web technology
  1. Searching directory paths

  2. Cannot find each other by any method

  3. By pointers

  4. None of the Above

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

In the .NET Framework, the Common Language Runtime (CLR) locates assemblies by searching directory paths, specifically looking in the application directory, private paths specified in configuration files, and the Global Assembly Cache (GAC).

Multiple choice technology web technology
  1. Constant

  2. Const

  3. Consta

  4. Fixed

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

Const is the VB.NET keyword for declaring constants - values that cannot be changed during program execution and must be initialized at declaration time. The other options are not valid VB.NET keywords for declaring constants.