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
-
Always returns a value.
-
Never returns a value.
-
Returns when RC is coded
-
I am skipping this!!
C
Correct answer
Explanation
In REXX, the EXIT instruction terminates the program immediately. It can optionally return a value to the caller (such as the operating system or another script) if an expression or a Return Code (RC) variable is provided. Without an expression, it returns no value. The other options are incorrect because returning a value is optional, not mandatory or impossible.
-
DO UNTIL
-
DO WHILE
-
ITERATE
-
Wrong question!
C
Correct answer
Explanation
ITERATE is a REXX command that skips the remaining instructions in the current DO loop iteration and immediately proceeds to the next iteration. DO UNTIL and DO WHILE are loop control structures that determine when the loop exits, not what skips within an iteration. Option D is clearly invalid.
-
using DEFINE
-
using DECLARE
-
Cant use alphanumeric variable in REXX
-
No need to define. REXX will deal them.
D
Correct answer
Explanation
REXX is typeless and dynamically typed - variables need no declaration and automatically handle alphanumeric values. DEFINE and DECLARE aren't REXX keywords for variable declaration.
-
DROP
-
DELSTACK
-
DELETE
-
Cant delete a stack
B
Correct answer
Explanation
DELSTACK is the REXX command to delete/remove a stack. DROP is for variables, DELETE isn't used for stacks, and stacks can be deleted.
A
Correct answer
Explanation
ALTER SEQUENCE in Oracle changes sequence properties for future numbers only. Already generated numbers and cached values remain unaffected. This prevents breaking existing references.
-
Buffer overflows are eliminated
-
Variables are renamed to provide more meaningful context
-
Exception handlers are added to catch runtime errors
-
New features are added based on the latest iterative design changes
B
Correct answer
Explanation
Refactoring is the process of restructuring existing computer code without changing its external behavior. Renaming variables to provide better readability and context is a classic refactoring activity.
D
Correct answer
Explanation
The DATA step uses _null_ which does not create a dataset. When proc print; runs, it attempts to print the most recently created dataset. Since no dataset was created, it results in an error.
-
Linking libraries statically increases executable file size and leads to code redundancy
-
Without dynamic linking the software cannot take advantage of higher-order functions
-
The software becomes subject to the linked libraries' license terms which may include usage fees
-
Lack of proper dynamic linking leads to library proliferation and increased "DLL hell"
A
Correct answer
Explanation
Statically linking libraries embeds all library code directly into the executable at build time, which increases file size significantly compared to dynamic linking where libraries are shared. Every statically linked application contains its own copy of library code, leading to code redundancy across multiple executables. Option B is incorrect - higher-order functions are language concepts unrelated to linking. Option C is wrong - both static and dynamic linking are subject to license terms. Option D describes 'DLL hell' which is a problem with dynamic linking, not static linking.
-
Don't link your modules to modules written in any other language
-
Make sure you declare all your variables' data types ahead of time
-
Don't add variables of one type to variables of another
-
Devout prayer
D
Correct answer
Explanation
Assembly language does not have built-in type checking or type safety features. Since the hardware only sees raw bytes and registers, type safety cannot be enforced by the language itself, making 'devout prayer' a humorous but accurate choice.
-
Use more global variables
-
Keep variable and function names down to one or two letters
-
Insert comments throughout your source code files
-
Use pointer arithmetic wherever possible
C
Correct answer
Explanation
Comments improve code maintainability by explaining intent, complex logic, and design decisions. Options A (global variables), B (short names), and D (pointer arithmetic) are widely recognized as anti-patterns that hurt reusability and maintainability.
B
Correct answer
Explanation
JavaScript is not related to Java. The similarity in names was a marketing decision by Netscape in 1995 when JavaScript was created. Java is a statically-typed, class-based language, while JavaScript is dynamically-typed and prototype-based. They are fundamentally different languages.
A
Correct answer
Explanation
For a REPEAT operation to continue indefinitely as long as a condition remains true, the count parameter should be set to -1. This indicates unlimited repetition. Setting count to 0 would typically mean no repetitions, 1 would execute once, and NULL might indicate an unset or default limited count.
-
lo w
-
lo worl
-
lo wo
-
index out of range error during compilation
B
Correct answer
Explanation
The substr(start, length) method extracts characters starting at index start for a specified length. For "Hello World", starting at index 3 ('l') for 7 characters yields "lo Worl" (case-sensitive 'W'). The stored option has a lowercase 'w', but it is the intended answer.
-
The code will generate a run time error
-
undefined, Local Date & Time.
-
The code will generate a compile time error.
-
Universal Date & Time, Local Date & Time.
-
Local Date & Time & Local Date & Time
-
The code will generate a run time error.
-
undefined, Local Date & Time.
-
The code will generate a compile time error.
-
Universal Date & Time, Local Date & Time.
-
Local Date & Time, Local Date & Time
D
Correct answer
Explanation
The toUTCString() method converts a Date object to a string using the UTC time zone (Universal Coordinated Time), while toString() returns the local date and time based on the system's time zone settings. This distinction is important when working with time-sensitive operations across different geographical regions.