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. Scans JCL for errors.

  2. Invalid Syntax

  3. Scans for previous executing jobs

  4. Does nothing!

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

TYPE=SCAN is a JCL parameter that validates the JCL syntax for errors without executing the job. It's a syntax-checking feature, not related to previous jobs or doing nothing.

Multiple choice technology mainframe
  1. Does Nothing!

  2. Terminates the program.

  3. Terminates the paragraph.

  4. Terminates the loop.

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

In COBOL, the EXIT statement is a no-operation statement that simply provides a common end point for a series of procedures or a paragraph. It does not terminate the program, loop, or paragraph on its own; it merely acts as a placeholder.

Multiple choice technology mainframe
  1. What's the problem in it? Will go fine!

  2. Program goes in infinite loop.

  3. Program will not execute.

  4. Compiler throws error.

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

In an independent COBOL program (not called by another program), GO BACK functions identically to STOP RUN - it terminates the program and returns control to the operating system. It will not cause infinite loops (B), prevent execution (C), or cause compiler errors (D).

Multiple choice technology testing
  1. Exit

  2. ExitAction

  3. Exit Action

  4. Exit Now

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

ExitAction is the specific QTP statement that terminates execution of the current action and moves to the next action. Exit alone is used in procedures, 'Exit Action' with a space is invalid syntax, and Exit Now is not a valid QTP statement.

Multiple choice technology programming languages
  1. True

  2. False

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

There are two CASE syntax forms in SQL: simple CASE (CASE expression WHEN value THEN result) and searched CASE (CASE WHEN condition THEN result). While they provide similar conditional logic, they are syntactically different - the simple CASE compares a single expression to values, while searched CASE evaluates full boolean conditions.

Multiple choice technology programming languages
  1. Signal

  2. Yield

  3. Iterator

  4. sealed

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

The yield keyword in C# signals the compiler that the method is an iterator block. It enables lazy evaluation by returning elements one at a time when requested, rather than building the entire collection first. This is essential for implementing custom iterators with IEnumerable.

Multiple choice technology programming languages
  1. #fcompile

  2. #file

  3. #pragma

  4. #instruct

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

The #pragma directive provides compiler-specific instructions or options for compilation. It's used for things like warning suppression, optimization settings, or other compiler behaviors. #fcompile, #file, and #instruct are not standard preprocessor directives.

Multiple choice technology web technology
  1. True

  2. False

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

C# does NOT support implicit fall-through from one case label to another, unlike C or C++. Each case block must explicitly end with a break, return, goto, throw, or similar statement. The only exception is empty case labels that immediately follow each other. This design prevents accidental fall-through bugs that are common in C-style languages.

Multiple choice technology programming languages
  1. var

  2. type

  3. typeof

  4. null

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

The var keyword in C# enables implicitly typed local variables, where the compiler determines the variable's type from the initialization expression. This is not dynamic typing - the type is fixed at compile-time based on what's assigned. The var keyword makes code more readable when the type is obvious from the initialization. Other options like typeof, type, and null don't provide this compiler inference capability.

Multiple choice technology programming languages
  1. override

  2. volatile

  3. unsafe

  4. virtual

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

In C#, the 'volatile' keyword indicates that a field can be modified by external factors such as the operating system, hardware, or concurrently executing threads. This prevents compiler optimizations that might assume the field's value doesn't change outside the current thread.

Multiple choice technology databases
  1. True

  2. False

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

Compilers generate low-level instructions (machine code or intermediate code) that are executed by the CPU or a runtime environment like JVM. DDL (Data Definition Language) interpreters are database tools that process schema definitions like CREATE TABLE commands - they don't execute compiled code.

Multiple choice technology mainframe
  1. True

  2. False

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

The PROCEDURE instruction in REXX creates a new variable scope, making all variables in the function/subroutine local by default. This means variables inside the procedure don't affect variables with the same name in the calling program unless explicitly exposed using the EXPOSE instruction.

Multiple choice technology mainframe
  1. Allow Variable-1 through variable-n to be shared with the main part of the program

  2. Used with the PROCEDURE instruction

  3. suppress Variable-1 through variable-n not to be share with main part of the program

  4. All the above

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

EXPOSE is used with PROCEDURE to selectively allow specific variables to be shared between the main program and the procedure, overriding the default local scope. Options A and B are correct: EXPOSE allows variables A through n to be shared, and it is used with PROCEDURE instruction. Option C is incorrect as EXPOSE enables sharing, doesn't suppress it.