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
B,D
Correct answer
Explanation
The if and else keywords are used for conditional branching in Java - if executes code when a condition is true, else handles the false case. catch and finally are part of exception handling (try-catch-finally blocks), not conditional flow control.
-
To create a mutable string
-
To store a single character
-
To store multiple items of the same type
-
none
C
Correct answer
Explanation
An array is a data structure used to store a fixed-size, sequential collection of multiple items of the same data type. A single character is stored in a primitive char variable, and mutable strings are handled by classes like StringBuilder or StringBuffer in Java.
-
a runtime error
-
No error is displayed
-
a compile time error
-
Only warning message is displayed
A
Correct answer
Explanation
FieldDefault PeopleCode executes during runtime processing, not during compilation. If an error occurs in FieldDefault logic, it manifests as a runtime error when the code executes. Compile-time errors occur when PeopleCode is saved/compiled, not when FieldDefault logic runs.
-
REASSIGN
-
REDECLARE
-
REDEFINE
-
None of the above
C
Correct answer
Explanation
In languages like Software AG's Natural or COBOL (with REDEFINES), the REDEFINE statement is used to refine or restructure already declared variables or memory fields. This allows programmers to map new structures or different data types to the same physical memory space.
-
char* text;
-
char *text;
-
Char * text;
-
char text*;
A
Correct answer
Explanation
char* text; follows the project's pointer declaration guideline - the asterisk is attached to the type, not the variable name. The alternative char *text places space between type and asterisk, which this project's guidelines specify as incorrect.
B
Correct answer
Explanation
The project's coding guidelines specify that each variable should NOT be individually declared on separate lines - hence the answer is False. This likely means the guideline encourages or allows multiple declarations per line for certain cases.
B
Correct answer
Explanation
REXX is an interpreted language, not a compiled one. The REXX interpreter reads and executes the source code directly without a compilation step. This is a key feature of REXX - you can write and test code immediately without waiting for compilation. Compiled languages like COBOL or PL/I require a compilation step to produce object code before execution. The statement that REXX requires compilation is false.
A
Correct answer
Explanation
The PARSE instruction in REXX is specifically designed for string manipulation and parsing. It can break strings into multiple variables using various templates (like PARSE VAR, PARSE VALUE, PARSE LINE, PARSE UPPER). The PARSE instruction with the 'X' suffix (like PARSE 'ABC'X) converts hexadecimal to character strings. Options B and C (PULL, PUSH) are stack operations, and STRING is not a REXX keyword.
-
Top of stack
-
Bottom of stack
-
Middle of stack
-
None of the above
A
Correct answer
Explanation
The PUSH instruction in REXX places data onto the top of the external data stack. This is a Last-In-First-Out (LIFO) structure where PUSH adds elements to the top, and PULL retrieves from the top. The stack grows upward, so new items are always placed 'on top' of existing items. Option B (bottom) and C (middle) are incorrect because PUSH always operates on the top of the stack.
-
Bottom of the stack
-
Top of the stack
-
Middle of the stack
-
None of the above
B
Correct answer
Explanation
When using REXX data stacks, the PULL instruction retrieves data from the top of the stack (LIFO by default, or FIFO depending on how the data was queued). It does not retrieve data from the middle or bottom of the stack.
-
EXPOSE
-
INTERPRET
-
TRACE
-
DEBUG
C
Correct answer
Explanation
The TRACE instruction in REXX is used for interactive debugging and program execution tracing. When TRACE is enabled (with options like TRACE ALL, TRACE RESULTS, TRACE INTERMEDIATE), REXX displays each instruction before execution and/or shows intermediate results, making it easier to debug logic errors and trace program flow. DEBUG is not a REXX keyword, and EXPOSE/INTERPRET serve other purposes.
-
PARSE PULL FORCE
-
PARSE PULL TERMINAL
-
PARSE EXTERNAL
-
Not possible
C
Correct answer
Explanation
PARSE PULL normally reads from the REXX data stack first. PARSE EXTERNAL bypasses the stack entirely and forces input directly from the terminal, regardless of queued data.
-
a. Never Abort
-
b. Abort on first Reject
-
c. Abort after 50 errors
-
d. Abort after 100 errors
-
a. Never Abort
-
b. Abort on first Reject
-
c. Abort after 50 errors
-
d. Abort after 100 errors
-
Functions always return the same result any time they are called with a specific set of input values.
-
Functions may return different results each time they are called with a specific set of input values
-
None
-
Both of Them
A
Correct answer
Explanation
Deterministic functions always return the identical result given the same set of input values and database state. Non-deterministic functions (like GETDATE() or RAND()) can return different values on subsequent invocations with the same parameters.