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
-
proc printto allows to redirect the output
-
no difference
-
proc printto is faster and takes less memory space
-
proc printto does not exists
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.
-
BPEL code which can generate faults should be placed within a try-catch block
-
BPEL code which can generate faults should be placed within a catch block
-
Several catch blocks can be added to the same BPEL scope
-
The CatchAll block cannot be used if a catch block is used in a scope
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.
-
. If a Remote Fault occurs, it will be caught by the catchAll block
-
. If a Binding Fault occurs, it will be caught by the catchAll block
-
. If a Remote Fault occurs, it will be caught first by the Remote Fault catch block and then by the catchAll block
-
. All faults will always be caught by the catchAll block
-
None of the above
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.
-
p is a pointer to pointer to integer
-
p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
p is a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity
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.
A
Correct answer
Explanation
A single COBOL IF statement evaluates exactly one condition. To check multiple conditions, you must nest IF statements or use the EVALUATE statement (available in COBOL-85 and later versions). Traditional COBOL has no built-in multi-comparison syntax in basic IF.
-
Infinite loop
-
Logical Error
-
Runtime Error
-
All of the above
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).
-
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
-
p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
p is a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
None of the above
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.
-
p is a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity
-
p is a function that returns a pointer to an integer quantity
-
None of the above
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.
-
p is a function that returns a pointer to an integer quantity
-
p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity
-
p is a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
None of the above
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 *).
-
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
-
p is a function that accepts an argument which is a pointer to a character array and returns an integer quantity
-
p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity
-
None of the above
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].
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.
A
Correct answer
Explanation
An overloaded operator as a non-static member function of a class implicitly receives the this pointer as its first argument. Therefore, a unary operator requires no explicit arguments when overloaded as a member function.
B
Correct answer
Explanation
In C++, operator overloading allows you to redefine the behavior of an operator for user-defined types, but it cannot change the operator's precedence, associativity, or the number of operands.
-
Error
-
10
-
5
-
None of the above
A
Correct answer
Explanation
The PL/SQL syntax is invalid. The GOTO statement requires properly defined labels with specific << and >> delimiters around a label name, not empty brackets. This code will fail compilation.
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.