Computer Knowledge
Programming Fundamentals
2,381 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
D
Correct answer
Explanation
COBOL standards allow up to 7 dimensions of tables, meaning up to 7 subscripts or indexes can be used for an OCCURS clause in nested table definitions.
-
MakeNull
-
SetNull
-
NullToEmpty
-
IfNull
D
Correct answer
Explanation
IfNull is primarily a SQL function (like MySQL's IFNULL), not a DataStage transformer function. DataStage uses SetNull(), MakeNull(), NullToEmpty(), IsNull(), and NullToValue() for null handling. The question tests familiarity with DataStage-specific function names versus generic SQL functions.
-
Scope terminator is used to mark the end of a verb
-
Scope terminator is used to mark the end of a statement
-
Both 1 and 2
-
None of the above
C
Correct answer
Explanation
A scope terminator marks the end of a verb or statement in COBOL. Explicit scope terminators like END-IF, END-PERFORM, END-READ make the code more readable and prevent ambiguity by clearly defining where a conditional or iterative construct ends. Both options 1 and 2 correctly describe the purpose of scope terminators.
-
IF THEN/ELSE
-
COND
-
BOTH
-
Steps cannot be skipped in JCL.
C
Correct answer
Explanation
JCL steps can be skipped using both conditional processing methods. The COND parameter tests return codes from previous steps. IF/THEN/ELSE (or IF/THEN/ELSE/ENDIF) constructs provide conditional logic. Statement D is false - steps can indeed be conditionally executed or skipped.
-
IF THEN/ELSE
-
COND
-
BOTH
-
Steps cannot be skipped in JCL.
C
Correct answer
Explanation
JCL steps can be skipped using both conditional processing methods. The COND parameter tests return codes from previous steps. IF/THEN/ELSE (or IF/THEN/ELSE/ENDIF) constructs provide conditional logic. Statement D is false - steps can indeed be conditionally executed or skipped.
-
IF THEN/ELSE
-
COND
-
BOTH
-
Steps cannot be skipped in JCL.
C
Correct answer
Explanation
JCL steps can be skipped using both COND parameters on EXEC statements and IF/THEN/ELSE construct statements. COND conditionally skips based on return codes from previous steps. IF/THEN/ELSE provides more complex conditional logic. Both are valid methods for conditional execution.
-
1, 2 and 4 are true
-
all statements are valid
-
Only 4 an d 5 are true
-
1, 4 and 5 are true
C
Correct answer
Explanation
Simple loops have no built-in entry or exit criteria; they execute indefinitely until manually exited. Statements 1 and 2 are false (no automatic criteria), while 4 and 5 are true (manual exit needed, otherwise infinite loop). Option C is correct.
-
The exception B will be handled in inner block
-
The exception B will be handled in outer block exception handler
-
The exception will not be handled as there is no handler defined for B in inner block
-
The exception section in inner block is executed and also Outer block exception section as we have defined there too
B
Correct answer
Explanation
When exception B is raised in the inner block's ELSE clause, it has no matching handler in that inner block (which only handles A). Unhandled exceptions propagate to the enclosing block, where B is caught. Option B correctly describes this propagation behavior.
-
If the function exists, it will be dropped and replaced with the new version created by the statement.
-
If the function does not exist, it will create a new one.
-
No action will be taken
-
There is no such option available.
A
Correct answer
Explanation
The REPLACE clause tells the database to drop an existing function of the same name and create the new definition instead of raising an error. This is precisely what the stored answer describes, so it is correct.
-
Procedures do not return values
-
Functions do not return values
-
Procedure always return values
-
None of these.
A
Correct answer
Explanation
Historically, functions must return a value, while procedures do not. Note that procedures can return values via OUT parameters in many databases, but standard definition-level differentiation is that procedures do not return values directly via a RETURN statement.
-
Both are same
-
case can check for non equality operator but decode checks for equality operator
-
decode can be used for comparing value of one variable/condition. but case can check for multiple conditions
-
case can not be used in where clause. but decode can be used.
B,C
Correct answer
Explanation
In PL/SQL and SQL, CASE statements support complex logical conditions and non-equality operators (like < or >), whereas DECODE is limited to equality checks. CASE also handles multiple distinct conditions. Distractors incorrectly equate them.
-
Buil-in
-
User-defined
-
User-function
-
Buil-in,User-defined
D
Correct answer
Explanation
QuickTest supports two types of environment variables: built-in variables provided by the system, and user-defined variables created by testers. This combination allows flexibility in test configuration.
A
Correct answer
Explanation
The main method CAN be overloaded - you can have multiple methods named 'main' with different parameter lists. However, only the standard main(String[] args) serves as the JVM entry point. Other overloaded main methods must be called explicitly like any other method. This is a common confusion point.
A
Correct answer
Explanation
Java allows the main method to be declared with any of the usual modifiers, including final. Declaring it final simply prevents the method from being overridden, which never happens for static methods anyway, so the statement is valid. The stored answer (True) is therefore correct.
A
Correct answer
Explanation
Local variables have block scope in most languages (Java, C, C++). If two blocks are disjoint (not nested), they can each declare variables with the same name without conflict. Each variable is only visible within its own block. This is valid and commonly used.