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
A
Correct answer
Explanation
The var keyword in C# enables implicitly typed local variables, where the compiler determines the variable's type from the initialization expression. This is not dynamic typing - the type is fixed at compile-time based on what's assigned. The var keyword makes code more readable when the type is obvious from the initialization. Other options like typeof, type, and null don't provide this compiler inference capability.
-
checked
-
sealed
-
readonly
-
fixed
D
Correct answer
Explanation
In C#, the 'fixed' statement prevents the garbage collector from relocating a movable variable. This is used in unsafe code contexts to pin a variable in memory, typically when working with pointers or interacting with unmanaged code.
-
override
-
volatile
-
unsafe
-
virtual
B
Correct answer
Explanation
In C#, the 'volatile' keyword indicates that a field can be modified by external factors such as the operating system, hardware, or concurrently executing threads. This prevents compiler optimizations that might assume the field's value doesn't change outside the current thread.
B
Correct answer
Explanation
Compilers generate low-level instructions (machine code or intermediate code) that are executed by the CPU or a runtime environment like JVM. DDL (Data Definition Language) interpreters are database tools that process schema definitions like CREATE TABLE commands - they don't execute compiled code.
A
Correct answer
Explanation
The PROCEDURE instruction in REXX creates a new variable scope, making all variables in the function/subroutine local by default. This means variables inside the procedure don't affect variables with the same name in the calling program unless explicitly exposed using the EXPOSE instruction.
-
Allow Variable-1 through variable-n to be shared with the main part of the program
-
Used with the PROCEDURE instruction
-
suppress Variable-1 through variable-n not to be share with main part of the program
-
All the above
A,B
Correct answer
Explanation
EXPOSE is used with PROCEDURE to selectively allow specific variables to be shared between the main program and the procedure, overriding the default local scope. Options A and B are correct: EXPOSE allows variables A through n to be shared, and it is used with PROCEDURE instruction. Option C is incorrect as EXPOSE enables sharing, doesn't suppress it.
-
Events
-
Value Set
-
Lookup Type
-
None of the Above
C
Correct answer
Explanation
In Oracle Workflow, a Lookup Type defines a list of possible values that can be referenced by messages, notifications, functions, or processes as their potential result types. It acts as a constrained set of valid outcomes for workflow components. Value Sets are different (they define valid values for parameters), and Events are workflow occurrences, not result type lists.
-
/BEFORE
-
/EXPRIED
-
all of the above
-
none of the above
C
Correct answer
Explanation
This question tests knowledge of VMS APPEND command qualifier compatibility rules. In VMS, the /CREATED qualifier (used with /MODIFIED, /BEFORE, /AFTER) has specific incompatibility rules. The /CREATED qualifier is incompatible with time-based selection qualifiers when used in certain combinations, and the question is designed to test that specific knowledge.
B
Correct answer
Explanation
In VMS DCL, the CALL command can pass up to 8 parameters to a subroutine. This is a built-in limitation of the CALL command syntax in VMS, which is important knowledge for writing DCL procedures that use subroutines.
-
strings
-
integers
-
floating point
-
booleans
C
Correct answer
Explanation
DCL supports strings, integers, and booleans natively. Floating-point numbers are not directly supported and require special handling or external commands for mathematical operations.
-
STOP RUN is the last executable statement of the main program. It returns control back to OS.
-
EXIT PROGRAM is the last executable statement of sub-program. It returns control back to main program.
-
GOBACK can be coded in main program as well as sub-program as the last statement. It just gives the control back from where it received the control.
-
None of the above.
A,B,C
Correct answer
Explanation
In COBOL, STOP RUN terminates the run unit and returns control to the OS. EXIT PROGRAM is used in a subprogram to return control to the calling program. GOBACK can be used in both and returns control to the caller. Thus, all three statements are correct.
-
One Value
-
More than One Value
-
No Value
-
User Defined Function will not return Value
-
JOB Statement
-
EXEC Statement
-
NONE
-
Both JOB and EXEC statement
D
Correct answer
Explanation
The COND parameter in JCL is used to test return codes from previous steps and control job/step execution based on those conditions. It can be specified on both JOB statements (to control execution of the entire job) and EXEC statements (to control individual job steps).
A
Correct answer
Explanation
COBOL was designed to be highly readable and English-like, using verbose syntax and descriptive names. This design philosophy makes COBOL programs self-documenting, meaning the code itself is easy to read and understand without extensive external documentation.
-
Names must be 10 or less characters.
-
Names must contain at least 1 alpha character in any position.
-
Names must be lower case.
-
Multiple word names must be separated with an underscore.
B
Correct answer
Explanation
COBOL requires user-defined names to contain at least one alphabetic character. Names can be 1-30 characters, can be mixed case, and hyphens (not underscores) are used in multi-word names. Numeric characters are allowed but not required.