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

Multiple choice technology programming languages
  1. proc printto allows to redirect the output

  2. no difference

  3. proc printto is faster and takes less memory space

  4. proc printto does not exists

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

In SAS, PROC PRINT writes data to the default output destination, whereas PROC PRINTTO is used to redirect SAS log or procedure output to an external file or alternative destination.

Multiple choice technology programming languages
  1. BPEL code which can generate faults should be placed within a try-catch block

  2. BPEL code which can generate faults should be placed within a catch block

  3. Several catch blocks can be added to the same BPEL scope

  4. The CatchAll block cannot be used if a catch block is used in a scope

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

BPEL fault handling uses catch blocks within scopes to handle specific fault types (Option B). Multiple catch blocks can handle different fault conditions in the same scope (Option C). Option A is incorrect - BPEL doesn't use 'try-catch' terminology. Option D is incorrect - CatchAll can be used with catch blocks.

Multiple choice technology programming languages
  1. . If a Remote Fault occurs, it will be caught by the catchAll block

  2. . If a Binding Fault occurs, it will be caught by the catchAll block

  3. . If a Remote Fault occurs, it will be caught first by the Remote Fault catch block and then by the catchAll block

  4. . All faults will always be caught by the catchAll block

  5. None of the above

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

In BPEL, fault handlers execute like try-catch blocks - only the first matching catch block executes, not all of them. Specific catches for Remote Fault and Binding Fault take precedence over the generic catchAll. Option C is wrong because BPEL doesn't chain exception handlers - once a fault is caught by its specific handler, processing stops there.

Multiple choice technology programming languages
  1. p is a pointer to pointer to integer

  2. p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity

  3. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity

  4. p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity

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

The syntax int p(char *a) declares a function named p that takes a pointer to a character (char *a) as its argument and returns an integer (int). It is not a pointer declaration.

Multiple choice technology mainframe
  1. Infinite loop

  2. Logical Error

  3. Runtime Error

  4. All of the above

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

COBOL IF statements can exhibit all three error types: infinite loops (when improperly nested in loops with incorrect exit logic), logical errors (incorrect condition logic leading to wrong execution path), and runtime errors (comparing incompatible data types or operating on invalid data).

Multiple choice technology programming languages
  1. p is a function that accepts an argument which is a pointer to a character and returns a pointer to a 10 element integer array

  2. p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity

  3. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity

  4. None of the above

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

The declaration int (p)(char *a) is read as: p is a pointer (declared with *p) to a function (the surrounding parentheses) that takes a char argument and returns an int. Option A incorrectly describes p as the function itself. Option C describes a function that returns int, not int*. The key is that the parentheses around *p force p to be interpreted as a pointer first, then binding to the function signature.

Multiple choice technology programming languages
  1. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity

  2. p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity

  3. p is a function that returns a pointer to an integer quantity

  4. None of the above

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

The declaration int p(void) declares p as a function that takes no arguments (void) and returns a pointer to an integer (int). Option A and B incorrectly claim the function accepts a char* argument, but void means no parameters. Option D is incorrect because option C is accurate.

Multiple choice technology programming languages
  1. p is a function that returns a pointer to an integer quantity

  2. p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity

  3. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity

  4. None of the above

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

In the declaration int *p(char *a), p is a function because of the function call parentheses (char *a). It takes a pointer to a character (char *a) as an argument and returns a pointer to an integer (int *).

Multiple choice technology programming languages
  1. p is a function that accepts an argument which is a pointer to a character and returns a pointer to a 10 element integer array

  2. p is a function that accepts an argument which is a pointer to a character array and returns an integer quantity

  3. p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity

  4. None of the above

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

The declaration int (p(char *a))[10] is complex: p is a function taking char and returning a pointer to an array of 10 ints. The syntax (p(char *a))[10] means p is a function (not a pointer), and it returns a pointer to [10]. Option B incorrectly says it returns an int. Option C describes a pointer-to-function, which would be written as int (*p)(char) without the [10].

Multiple choice technology programming languages
  1. True

  2. False

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

Function overloading in C++ requires differences in the parameter list (type, number, or order). Return type alone cannot distinguish overloaded functions because the compiler cannot determine which version to call based solely on the return type, especially in expressions where the return value might be discarded.

Multiple choice technology programming languages
  1. True

  2. False

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

References in C++ must be initialized upon declaration and cannot be reseated (assigned to refer to a different object). Since arrays require elements that can be default-constructed and reassigned, arrays of references are prohibited by the language specification.