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. reinterpret_cast

  2. static_cast

  3. dynamic_cast

  4. const_cast

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Constants:x(3) type c value '123'.

  2. Data:x(3) type c.

  3. Constants:x(3) type c.

  4. Data:x(3) type c value '123'.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. func( 9, 5.67 )

  2. func( 4 )

  3. func()

  4. func( ,4 )

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. RAISE

  2. PRAGMA EXCEPTION_INIT

  3. OTHERS

  4. EXCEPTION

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. loads a new record into the input buffer if an end-of-record is found in the current record

  2. holds the current data line in the buffer for another input statement to process

  3. can be used to read multiple observations from a single data line

  4. is a syntax error

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Primary!

  2. Delete!

  3. Original!

  4. Sort!

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Reject the data value with no message box

  2. Accept the data value

  3. Reject the data value but allow focus to change

  4. Reject the data value and show an error message box

Reveal answer Fill a bubble to check yourself
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).

Multiple choice technology web technology
  1. MSIL

  2. CLS

  3. CLR

  4. CTS

Reveal answer Fill a bubble to check yourself
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.