Computer Knowledge

Programming Fundamentals

2,381 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. an operator

  2. a label

  3. a variable

  4. a function

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

The goto statement transfers control to a labeled statement within the same function. You use goto with a label like 'my_label:' and then 'goto my_label;' to jump to that point. Option B correctly states that goto causes control to go to 'a label'. It cannot jump to operators (A), variables (C), or functions (D) - only to labeled statements within the current function.

Multiple choice
  1. the loop in which it occurs

  2. the block in which it occurs

  3. the function in which it occurs

  4. the program in which it occurs

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

The exit() function in C++ terminates the entire program immediately, not just the current function or loop. It performs cleanup and ends program execution. Option D correctly states it causes exit from 'the program in which it occurs'. This is different from return, which only exits from the current function. The exit() function is defined in header and affects the whole program.

Multiple choice
  1. a window which is used to write a visual basic code for an application

  2. a small screen which is used to reposition the form of the application, so that it appears in proper place when project is run

  3. a window used for each form to customise the designed interface of the application

  4. a window which contains list of the forms and modules for the current projects

  5. a window which display list of properties settings for a selected form or a control

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

This window is called Form Designer Window.

Multiple choice
  1. IF-ELSE

  2. DO-WHILE

  3. FOR-NEXT

  4. WHILE

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

IF-ELSE is a conditional branching structure that executes different code blocks based on a condition. It does not repeat code execution. DO-WHILE, FOR-NEXT, and WHILE are all looping constructs that repeatedly execute code blocks.

Multiple choice
  1. The local variable is overwritten.

  2. A function pointer is overwritten.

  3. A parameter of a different stack frame is overwritten.

  4. It occurs in the heap data area and is exploitable in a manner different from that of stack-based overflows.

  5. The execution will resume at the return address as specified by the attacker, usually a user-input filled buffer.

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

This is incorrect.

Multiple choice
  1. It prevents execution of code on the stack or the heap.

  2. An attacker may use buffer overflows to insert arbitrary code into the memory of a program.

  3. Some Unix-based systems support executable space protection.

  4. This approach uses packet scanning method.

  5. Executable space protection does not protect against return-to-libc attacks.

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

Executable space protection mechanism does not use packet scanning method.

Multiple choice
  1. C++ uses the scope resolution operator to resolve ambiguity between functions.

  2. C++ supports function overloading to resolve ambiguity.

  3. Each function is unique in C++.

  4. C++ does not provide any mechanism to resolve function ambiguity.

  5. Both (1) and (2)

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

Correct

Multiple choice
  1. Unable to open include file iosteam.h

  2. Undefined symbol cout

  3. Both (1) and (2)

  4. The program will compile and execute normally.

  5. It will give a warning to the user.

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

Both errors are displayed in this program.