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
-
reinterpret_cast
-
static_cast
-
dynamic_cast
-
const_cast
A
Correct answer
Explanation
reinterpret_cast is used for low-level reinterpreting of bit patterns between inherently incompatible pointer types (e.g., int* to char*). static_cast is for related types, dynamic_cast for polymorphic downcasting, and const_cast for removing const/volatile.
A
Correct answer
Explanation
In Documentum, custom object types can be created without specifying a super type, though they will typically default to inheriting from dm_sysobject. The statement reflects that creating a custom type doesn't strictly require explicitly defining a super type in the creation command.
-
COBOL-68
-
COBOL-74
-
COBOL-85
-
COBOL-9x
C
Correct answer
Explanation
COBOL-85 was the version where the GO TO statement was eliminated from the standards. Earlier versions (68, 74) still included GO TO, and COBOL-9x maintained this structured programming approach without GO TO.
-
Type N
-
Type C
-
Type F
-
Type P
C
Correct answer
Explanation
In ABAP, Type F (floating point) cannot be used to define parameters in FORM/PERFORM statements, whereas Types C (character), N (numeric character), and P (packed) are valid parameter types.
-
Constants:x(3) type c value '123'.
-
Data:x(3) type c.
-
Constants:x(3) type c.
-
Data:x(3) type c value '123'.
C
Correct answer
Explanation
In ABAP, CONSTANTS declarations must include a VALUE clause to specify the constant's value. Option C 'Constants:x(3) type c.' lacks the required VALUE clause, causing a syntax error. DATA statements (options B and D) can optionally include values, so they are syntactically valid.
B
Correct answer
Explanation
In C++, a function prototype is only required if the function is called before it is defined in the file. If the complete function definition appears before the first function call, the definition itself serves as the declaration. The compiler can determine the function's signature from its definition.
-
func( 9, 5.67 )
-
func( 4 )
-
func()
-
func( ,4 )
D
Correct answer
Explanation
In C++, when calling a function with default parameters, you cannot skip an earlier parameter while providing a value for a later parameter. If you want to specify the second parameter, you must also provide a value for the first parameter. The syntax 'func(,4)' is invalid because it omits the first argument.
-
Pointer
-
References
-
Both
-
None of the above
A
Correct answer
Explanation
A const pointer (pointer to const data) cannot be implicitly assigned to an ordinary (non-const) pointer because this would allow modification of data that was declared as constant. This would violate the const-correctness principle of C++. You would need an explicit const_cast to perform this conversion, and even then, modifying the data through the resulting pointer is undefined behavior.
-
RAISE
-
PRAGMA EXCEPTION_INIT
-
OTHERS
-
EXCEPTION
A,D
Correct answer
Explanation
In PL/SQL, user-defined exceptions are raised using the RAISE statement. The EXCEPTION keyword is used in the exception declaration section (EXCEPTION_INIT pragma links error codes to exceptions) and in the exception handling block (BEGIN...EXCEPTION...END). To actually raise a user-defined exception, you must declare it, then use RAISE exception_name.
-
loads a new record into the input buffer if an end-of-record is found in the current record
-
holds the current data line in the buffer for another input statement to process
-
can be used to read multiple observations from a single data line
-
is a syntax error
B,C
Correct answer
Explanation
In SAS, double trailing @@ in an INPUT statement holds the current data line in the input buffer, allowing multiple INPUT statements to read data from the same line. This enables reading multiple observations from a single data line, which is the practical use case.
-
Primary!
-
Delete!
-
Original!
-
Sort!
D
Correct answer
Explanation
PowerBuilder Datawindow buffers are Primary!, Delete!, and Filter! buffers. The Original! buffer contains the originally retrieved data. Sort! is not a standard Datawindow buffer type - sorting is handled through the Datawindow's sort properties, not a dedicated buffer.
-
Reject the data value with no message box
-
Accept the data value
-
Reject the data value but allow focus to change
-
Reject the data value and show an error message box
C
Correct answer
Explanation
In PowerBuilder's ItemError event, return code 3 means 'Reject the value' (discard invalid data) while 'allow focus to change' (user can move to another field). This differs from return code 2 (reject with message box) and return code 1 (accept the value).
C
Correct answer
Explanation
The CLR (Common Language Runtime) is where .NET code actually executes. It provides services like memory management, security, and JIT compilation. MSIL (Microsoft Intermediate Language) is the compiled code format, CLS (Common Language Specification) defines language interoperability rules, and CTS (Common Type System) defines type system rules - none of these execute code directly.