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
  1. syntax errors

  2. semantic errors

  3. logical errors

  4. internal errors

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

Compilers are designed to detect syntax errors, which are violations of the language's grammatical rules. Semantic and logical errors are often harder to detect at compile time.

Multiple choice
  1. evaluate an arithmetic expression in postfix form

  2. implement recursion

  3. convert a given arithmetic expression in infix form to its equivalent postfix form

  4. allocate resources (like CPU) by the operating system

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

Stacks are LIFO structures used for expression evaluation, recursion, and syntax parsing. CPU scheduling typically uses queues (like round-robin) or priority queues, not stacks.

Multiple choice
  1. all input entries whether they contain errors or not

  2. correct entries only

  3. inputs with errors only

  4. none of the above

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

An exception report is designed to highlight only those items that deviate from the expected criteria, such as input errors, to save time for the reviewer.

Multiple choice
  1. once

  2. twice

  3. thrice

  4. None of these

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

The 'FOR-DO' construct (or a standard 'do-while' loop in many languages) is designed to execute the loop body at least once before checking the condition.

Multiple choice
  1. The ellipsis is a throwback from K&R C. In accordance with Standard C, the declaration of args should be moved into the parameter list, and the K&R C macro va_arg() should be deleted from the code.

  2. vfprintf() does not conform to ISO 9899: 1990, and may not be portable.

  3. Library routines that accept argument lists cause a fault on receipt of an empty list. The argument list must be validated with va_null() before invoking vfprintf().

  4. The argument list args has been improperly initialized.

  5. Variadic functions are discontinued by Standard C; they are legacy constructs from K&R C, and no longer compile under modern compilers.

Reveal answer Fill a bubble to check yourself
A Correct answer