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
-
Scans JCL for errors.
-
Invalid Syntax
-
Scans for previous executing jobs
-
Does nothing!
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.
-
Does Nothing!
-
Terminates the program.
-
Terminates the paragraph.
-
Terminates the loop.
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.
-
What's the problem in it? Will go fine!
-
Program goes in infinite loop.
-
Program will not execute.
-
Compiler throws error.
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).
-
Exit
-
ExitAction
-
Exit Action
-
Exit Now
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.
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.
-
Signal
-
Yield
-
Iterator
-
sealed
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.
-
#fcompile
-
#file
-
#pragma
-
#instruct
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.
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.
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.
-
checked
-
sealed
-
readonly
-
fixed
D
Correct answer
Explanation
In C#, the 'fixed' statement prevents the garbage collector from relocating a movable variable. This is used in unsafe code contexts to pin a variable in memory, typically when working with pointers or interacting with unmanaged code.
-
override
-
volatile
-
unsafe
-
virtual
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.
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.
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.
-
Allow Variable-1 through variable-n to be shared with the main part of the program
-
Used with the PROCEDURE instruction
-
suppress Variable-1 through variable-n not to be share with main part of the program
-
All the above
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.