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

Multiple choice technology mainframe
  1. There is either a JCLLIB statement for the entire JOB, or a separate one for each EXEC

  2. A JCLLIB statement can not have a statement name.

  3. There can only be one JCLLIB statement per JOB.

  4. A JCLLIB statement must be coded before the first EXEC statement.

Reveal answer Fill a bubble to check yourself
C,D Correct answer
Explanation

JCLLIB statement rules in JCL are specific. Option C is correct because only one JCLLIB statement is allowed per JOB - it defines the private library for the entire job. Option D is correct because JCLLIB must be placed before the first EXEC statement in the job. Option A is incorrect because JCLLIB is job-scoped, not per EXEC. Option B is incorrect because JCLLIB is a statement type itself and follows JCL naming rules. The JCLLIB statement enables cataloged procedure access by specifying a private library search order.

Multiple choice technology mainframe
  1. COND=(8,LE)

  2. COND=(8,GE)

  3. COND=(8,LT)

  4. COND=(8,GT)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In JCL, COND parameters test if a condition is true to bypass/skip execution. To execute only if the previous return code (RC) is strictly less than 8, we want to bypass if RC is greater than or equal to 8. Hence, COND=(8,LE) is correct because it bypasses execution if 8 is Less than or Equal to RC (meaning RC >= 8).

Multiple choice technology mainframe
  1. The COND parameter always indicates that if its condition is met, the step is NOT executed.

  2. When adding the COND parameter to an EXEC statement that calls a procedure, this COND

  3. With the COND parameter, we can only check return codes.

  4. The COND parameter can check the return codes of multiple steps, but as soon as one of

Reveal answer Fill a bubble to check yourself
B,D Correct answer
Explanation

The COND parameter controls conditional step execution based on previous step return codes. Option B is correct because a COND parameter on an EXEC calling a procedure applies to ALL steps in that procedure, not just the first. Option D is correct because COND can test multiple step return codes - if any condition is true, the step is bypassed. Option A is incorrect because COND only skips execution when its condition evaluates TRUE (meaning the condition was met). Option C is incorrect because COND tests return codes, not just checks them - it evaluates whether codes meet specified comparison criteria (EQ, NE, GT, LT, GE, LE).

Multiple choice technology web technology
  1. //TU00001T JOB (ATUT000,,,,,,,,),TU00001,CLASS=7,MSGCLASS=X

  2. //TU00001T JOB (ATUT000),’TU00001’,CLASS=7,MSGCLASS=X

  3. //TU00001T JOB TU00001,’(ATUT000)’,CLASS=7,MSGCLASS=X

  4. //TU00001T JOB ,(ATUT000),CLASS=7,MSGCLASS=X

Reveal answer Fill a bubble to check yourself
A,B Correct answer
Explanation

JCL JOB statement positional parameters follow strict order: accounting information (in parentheses), then programmer name. Option A correctly places accounting info (ATUT000) in positional form followed by the programmer name (TU00001). Option B is equivalent with quoted parameters. Options C and D are incorrect because they reverse the positional order or use improper syntax.

Multiple choice technology mainframe
  1. INFO-PROGRAM-ID

  2. INFO-CONVERSATION

  3. INFO-PREVIOUS-PROGRAM-ID

  4. INFO-FUNCTION-KEY

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

INFO-FUNCTION-KEY is specifically designed to store the function key number when a function key is received in CICS. The other variables serve different purposes: INFO-PROGRAM-ID for program name, INFO-CONVERSATION for mode status, and INFO-PREVIOUS-PROGRAM-ID for tracking the prior program.

Multiple choice technology mainframe
  1. INFO-PROGRAM-ID

  2. INFO-PREVIOUS-PROGRAM-ID

  3. INFO-CONVERSATION

  4. INFO-PASSOFF

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In APS (Application Development System) COBOL generators, the INFO-PASSOFF variable is set to 'Y' when the program is invoked using a PASSOFF statement, whereas the other options store different context metadata.

Multiple choice technology mainframe
  1. Identification Division.

  2. Program-ID.

  3. Program-name.

  4. All the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To compile a COBOL program without errors, the minimum requirements are: Identification Division (which contains the Program-ID paragraph) and the Program-ID paragraph itself (which specifies the program name). All these components are mandatory and must be present for the program to be syntactically valid and compilable.

Multiple choice technology programming languages
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Java, dividing a floating-point number by zero does not throw an exception. Instead, it produces positive or negative infinity (Float.POSITIVE_INFINITY in this case). Only integer division by zero throws ArithmeticException. Therefore the statement does NOT throw an exception, making 'False' the correct answer.

Multiple choice technology programming languages
  1. macro functions are expanded during compile. Inline functions are just usual functions calls

  2. macro functions are expanded during preprocessing and inline functions are expanded during compile

  3. macro functions are expanded during compile and inline functions are expanded during preprocessing

  4. No difference.Both are expanded at compile.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Macro functions (created with #define) are expanded by the preprocessor before compilation begins, resulting in text substitution. Inline functions are expanded by the compiler during compilation, with the inline keyword being a hint (not a guarantee) for function call replacement. Option A is wrong because it misstates when inline expansion occurs. Option C reverses the correct phases.

Multiple choice technology programming languages
  1. malloc is used to allocate store for integer arrays only

  2. new is used to allocate store for objects only

  3. new is used to allocate any kind of memory

  4. malloc is used to allocate any kind of memory

  5. new initializes the store after allocation

  6. malloc intializes the store after allocation

Reveal answer Fill a bubble to check yourself
C,D Correct answer
Explanation

Both malloc and new can allocate memory for any type, not just arrays or objects. In C++, new automatically initializes objects by invoking their constructors, whereas malloc simply allocates raw bytes of memory without performing initialization.

Multiple choice technology web technology
  1. 2

  2. 4

  3. 3

  4. 1

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

.NET has two levels of compilation. First, the language compiler (like C# or VB.NET) converts source code to Intermediate Language (IL). Second, the JIT compiler converts IL to native machine code at runtime. This two-stage process enables cross-language integration.