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
-
Option Declare
-
Option Explicit
-
Option Mandate
-
None
B
Correct answer
Explanation
Option Explicit is the VBScript statement that forces explicit declaration of all variables before use. This helps catch typos and undeclared variable errors at runtime, improving code reliability and debugging.
A
Correct answer
Explanation
VBScript is a variant-type language where all variables are of type Variant and can hold any data type. You cannot declare variables with specific data types like Integer, String, or Boolean - the Variant type adapts automatically.
B
Correct answer
Explanation
VBScript is not case-sensitive. Variable names, keywords, and function names can be written in any combination of uppercase and lowercase letters - the interpreter treats them as identical.
-
While … Wend
-
Do While … Loop
-
Do Until … Loop
-
VB Script doesn't have any deprecated loops at all.
A
Correct answer
Explanation
In VBScript, While ... Wend is considered obsolete and deprecated in favor of the more flexible Do ... Loop structures. The language reference recommends avoiding While ... Wend in modern scripts.
B
Correct answer
Explanation
A conventional For loop using an index counter can iterate through collections by index (e.g., using Item(i) or id(i)), so a For Each loop is not strictly mandatory, making the statement false.
B
Correct answer
Explanation
This statement is false. In VBScript, Functions return values but Subroutines do not. Subroutines perform actions without returning a value to the caller, while Functions are designed specifically to return values. The statement reverses the actual behavior.
A
Correct answer
Explanation
GETCURSOR is a statement in SAP ABAP used to capture the field value and position when a user double-clicks on a field in a list (ALV or basic list). It stores the field name, value, and line number, allowing the program to trace which specific data element was interacted with. This is commonly used for drill-down functionality and interactive reporting.
B
Correct answer
Explanation
In ABAP, internal tables passed using the TABLES parameter are passed by reference (address), not by value and result. The TABLES keyword creates a reference to the original internal table, so any changes made within the subroutine directly affect the calling program's table. Value and result would mean copying the entire table structure on both entry and exit, which would be inefficient for large internal tables.
-
CASE
-
ISNULL
-
ISNUMERIC
-
ISDATE
-
None
D
Correct answer
Explanation
A deterministic function always returns the same result for the same input. Non-deterministic functions can return different results. ISDATE is non-deterministic because its behavior depends on session settings like DATEFORMAT and LANGUAGE - the same string might be interpreted differently. CASE, ISNULL, and ISNUMERIC are deterministic functions.
-
Evaluate variable
-
refresh variable
-
set variable
-
all the above
A
Correct answer
Explanation
In programming and scripting environments, conditions are typically evaluated using an "evaluate variable" or similar conditional evaluation mechanism. The other options like 'set variable' (assignment) and 'refresh variable' (updating value) are not primarily used for condition checking. Option D 'all the above' would be incorrect since not all listed operations are used for checking conditions.
-
The control will come back to Program A
-
The control will not come back to Program A and program B will terminate at the end of the STOP RUN statement
-
Program B abends Abnormally
-
Infinite loop
B
Correct answer
Explanation
In COBOL, the STOP RUN statement terminates the entire run unit, not just the current program. When Program B (called program) executes STOP RUN, it immediately ends program execution and control does NOT return to Program A (the calling program). This is different from GOBACK or EXIT PROGRAM which would return control to the caller.
-
Perform Para-1
-
Perform Para-1 Thru Para-2
-
Perform Section-2 Section
-
Perform Para-1 20 times
C
Correct answer
Explanation
In COBOL, you perform paragraphs or sections. 'Perform Section-2 Section' is invalid syntax because appending the word 'Section' after the name in a PERFORM statement is incorrect. The other statements are valid standard COBOL syntax formats.
-
Infinite loop
-
Logical Error
-
Runtime Error
-
All the above
D
Correct answer
Explanation
COBOL IF statements can generate multiple error types: infinite loops from poorly designed conditions, logical errors from incorrect condition logic, and runtime errors from data type mismatches or boundary violations. All three error categories are possible in IF statement implementations.
-
Scans JCL for errors
-
Invalid Syntax
-
Scans for previous executing jobs
-
Does nothing
A
Correct answer
Explanation
SCAN is a JCL (Job Control Language) statement that performs syntax checking on the JCL itself. It scans for errors without executing the job, helping catch issues before actual processing. The other options are incorrect - SCAN is not for previous jobs, syntax errors, or doing nothing.
B
Correct answer
Explanation
SAS has two line pointer controls for input data: / (forward slash) moves to the next record, and #n (like #5) moves to column n. These control where the INPUT statement reads from in the data lines. Options 1, 3, and 4 are incorrect counts.