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 programming languages
  1. 1, 3 and 4

  2. 2, 3 and 4

  3. 2, 3 and 6

  4. 1, 3 and 5

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

To call an external procedure that returns a value, you must: (2) Declare it with RETURNS clause specifying the return type, (3) Declare both the parameter and result variables, and (6) Call it as a function assignment with the parameter. Option A is incomplete (no RETURNS, wrong call syntax), Option B uses wrong call syntax (CALL with function), Option D omits RETURNS.

Multiple choice technology programming languages
  1. PLbbb (bbb = 3 blanco’s)

  2. COBOL

  3. COBPL

  4. PLBOL

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

VAR1 is 'PL/I' (5 chars). VAR2 receives 'PL/I' but is 10 chars, so it becomes 'PL/I ' (padded with 5 blanks). VAR3 is CHAR(2), so it receives only the first 2 characters 'PL'. RESULT, which is CHAR(5), gets 'PL' from VAR3, then padded with 3 blanks → 'PLbbb'. The variable length truncation at assignment to VAR3 is the key behavior.

Multiple choice technology programming languages
  1. 1

  2. 2

  3. 3

  4. 4

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

Option 2 (DCL ARRAY_1 (5,2) DEC FIXED (3)) is NOT correct because PL/I requires the data type attributes to precede the dimension bounds. The correct form is either option 1 (type first, then bounds) or option 3 (bounds with separate type clauses). Option 4 is also invalid syntax.

Multiple choice technology programming languages
  1. True

  2. False

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

Interpreted languages like Perl generally execute slower than compiled languages because they must parse and translate code at runtime. However, modern JIT compilation and optimized engines make the absolute statement 'never execute as fast' technically debatable, though traditionally accepted as true in this context.

Multiple choice technology mainframe
  1. Scans JCL for errors.

  2. Invalid Syntax

  3. Scans for previous executing jobs

  4. Does nothing!

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

TYPE=SCAN is a JCL parameter that validates the JCL syntax for errors without executing the job. It's a syntax-checking feature, not related to previous jobs or doing nothing.

Multiple choice technology mainframe
  1. Does Nothing!

  2. Terminates the program.

  3. Terminates the paragraph.

  4. Terminates the loop.

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

In COBOL, the EXIT statement is a no-operation statement that simply provides a common end point for a series of procedures or a paragraph. It does not terminate the program, loop, or paragraph on its own; it merely acts as a placeholder.

Multiple choice technology mainframe
  1. What's the problem in it? Will go fine!

  2. Program goes in infinite loop.

  3. Program will not execute.

  4. Compiler throws error.

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

In an independent COBOL program (not called by another program), GO BACK functions identically to STOP RUN - it terminates the program and returns control to the operating system. It will not cause infinite loops (B), prevent execution (C), or cause compiler errors (D).

Multiple choice technology testing
  1. Exit

  2. ExitAction

  3. Exit Action

  4. Exit Now

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

ExitAction is the specific QTP statement that terminates execution of the current action and moves to the next action. Exit alone is used in procedures, 'Exit Action' with a space is invalid syntax, and Exit Now is not a valid QTP statement.

Multiple choice technology programming languages
  1. True

  2. False

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

There are two CASE syntax forms in SQL: simple CASE (CASE expression WHEN value THEN result) and searched CASE (CASE WHEN condition THEN result). While they provide similar conditional logic, they are syntactically different - the simple CASE compares a single expression to values, while searched CASE evaluates full boolean conditions.

Multiple choice technology programming languages
  1. Signal

  2. Yield

  3. Iterator

  4. sealed

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

The yield keyword in C# signals the compiler that the method is an iterator block. It enables lazy evaluation by returning elements one at a time when requested, rather than building the entire collection first. This is essential for implementing custom iterators with IEnumerable.

Multiple choice technology programming languages
  1. #fcompile

  2. #file

  3. #pragma

  4. #instruct

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

The #pragma directive provides compiler-specific instructions or options for compilation. It's used for things like warning suppression, optimization settings, or other compiler behaviors. #fcompile, #file, and #instruct are not standard preprocessor directives.

Multiple choice technology web technology
  1. True

  2. False

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

C# does NOT support implicit fall-through from one case label to another, unlike C or C++. Each case block must explicitly end with a break, return, goto, throw, or similar statement. The only exception is empty case labels that immediately follow each other. This design prevents accidental fall-through bugs that are common in C-style languages.