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
-
Package and function
-
Function and userexit
-
Procedure and package
-
Function and procedure
D
Correct answer
Explanation
In relational database systems like DB2, routine objects include user-defined functions and procedures. Packages are compiled objects containing SQL statements, not routines themselves, while userexits are external programs for task-specific processing rather than standard routine objects.
B
Correct answer
Explanation
The code uses tryVariableArguments.arguments which is an obsolete, deprecated syntax. In modern JavaScript (and even in older implementations), the correct way is to use the arguments object directly within the function, not as a property of the function name. This code will fail in contemporary browsers.
B
Correct answer
Explanation
JavaScript functions are first-class objects and their names are identifiers within the same scope. Declaring a function and variable with the same name causes a namespace collision where one overrides the other. Because JavaScript does not separate these namespaces, it does not distinguish between them.
B
Correct answer
Explanation
parseJSON is not a standard built-in JavaScript function. The standard method for parsing JSON strings is JSON.parse(). The parseJSON function might have existed in some non-standard implementations or specific libraries, but it's not part of core JavaScript like alert() or eval().
-
a.SAS continues processing the step.
-
a.SAS continues to process the step, and the SAS log displays messages about the error.
-
a.SAS stops processing the step in which the error occurred, and the SAS log displays messages about the error.
-
SAS stops processing the step in which the error occurred, and the Output window displays messages about the error.
C
Correct answer
Explanation
When SAS encounters a syntax error, it immediately stops processing the step containing the error, prints warning or error messages to the SAS log, and continues checking subsequent steps. It does not output these messages to the Output window.
B
Correct answer
Explanation
Nested functions are NOT allowed in standard C. While some compilers (like GCC) support nested functions as an extension, they are not part of the C language standard. C was designed to be a simple language with functions that can only be defined at file scope, not inside other functions.
A
Correct answer
Explanation
This is the correct syntax for declaring a function pointer in C. 'int (*pt2Function) (float, char, char)' declares pt2Function as a pointer to a function that takes a float and two char parameters and returns an int. The parentheses around *pt2Function are crucial - they make it a pointer to a function rather than a function returning a pointer.
A
Correct answer
Explanation
Two function pointers can indeed be compared using the == operator. This checks if they point to the same function address. If both pointers point to the same function, the comparison returns true; otherwise, it returns false. This is valid and commonly used in C programming.
-
Code Area
-
Data Area
-
Stack Area
-
Heap Area
C
Correct answer
Explanation
In Java's memory model, local primitive variables and local reference variables are stored in the Stack Area. Each thread has its own stack, where method frames containing local variables and partial results are pushed when methods are invoked. The Heap stores objects, Code Area stores bytecode, and Data Area stores static/class variables.
-
the use of a variable before it has been defined
-
unreachable (“dead”) code
-
memory leaks
-
array bound violations
C
Correct answer
Explanation
Static analysis analyzes source code without executing it. It can find syntax errors, dead code, undefined variables, and array bound violations. However, memory leaks are dynamic run-time anomalies that static analysis cannot reliably identify, requiring dynamic execution to detect accurately.
-
Scan - check the syntax error and will hold the job, Hold - Checks the syntax error
-
Scan - will hold the Job, Hold - check for the syntax error
-
Scan - checks the syntax error, Hold - will hold the job if there is no error and will end with JCL error if there is syntax error
-
Scan and Hold both will check the syntax error and none of them will hold the job
C
Correct answer
Explanation
TYPRUN=SCAN checks JCL syntax without executing the job. TYPRUN=HOLD also checks syntax but holds the job in input queue if error-free, or issues JCL error if syntax errors exist. Neither option actually holds a job with errors - SCAN just reports, HOLD only holds if syntax is valid.
-
Scan - check the syntax error and will hold the job, Hold - Checks the syntax error
-
Scan - will hold the Job, Hold - check for the syntax error
-
Scan - checks the syntax error, Hold - will hold the job if there is no error and will end the job with JCL error if there is syntax error
-
Scan and Hold both will check the syntax error and none of them will hold the job
C
Correct answer
Explanation
TYPRUN=SCAN checks JCL syntax without executing the job. TYPRUN=HOLD also checks syntax but holds the job in input queue if error-free, or issues JCL error if syntax errors exist. This is nearly identical to question 153673 with slight wording difference ('end the job with' vs 'end with').
A
Correct answer
Explanation
To release a job from HOLD status in the spool, you type the character 'A' in front of the job name. This tells the system to alter the job's status and release it from the hold queue. Options B, C, and D are not valid commands for this purpose.
B
Correct answer
Explanation
This program has 5 decision points (IF A>=10, ELSEIF B>5, ELSEIF A>B, ELSE IF B>A, and the implicit ELSE). To achieve decision coverage, each decision must be tested with both true and false outcomes. The minimum 5 test cases are: (1) A>=10 true, (2) A<10, B>5 true, (3) A<10, B<=5, A>B true, (4) A<10, B<=5, A<=B, B>A true, (5) All conditions false (A=B). Option A (8) is for multiple condition coverage, while C (7) and D (6) don't account for all decision branches.
-
NEW_LINE
-
PUT
-
PUT_LINE
-
PUTF
-
None of the above
C
Correct answer
Explanation
PUT_LINE in UTL_FILE package writes text to a file and automatically appends a line terminator (newline character) after each call. PUT writes without any terminator, while PUTF is for formatted output without automatic line termination. NEW_LINE is not a valid UTL_FILE procedure.