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

Multiple choice
  1. bug

  2. debug

  3. cursor

  4. icon

  5. None of these

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

In computing terminology, an error or flaw in a program is commonly called a 'bug'. Debug is the process of finding and fixing bugs. Cursor is the on-screen indicator, and icon is a graphical symbol.

Multiple choice
  1. ensures that only the correct data type is entered into a field

  2. verifies that all required data is present

  3. determines whether a number is within a specified limit

  4. tests if the data in two or more associated fields is logical

  5. None of these

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

A range check validates that entered data falls within specified minimum and maximum boundaries. It's different from type checking (ensures correct data type), completeness check (ensures required fields are filled), or consistency check (ensures logical relationships between fields).

Multiple choice
  1. executed

  2. referenced

  3. imported

  4. declared

  5. None of these

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

In Java, packages must be imported using the import statement before they can be used in a program. This makes the classes and interfaces from the package available to your code. Packages don't need to be executed, referenced (too vague), or declared before use - they must be explicitly imported.

Multiple choice
  1. begin the line with a # sign

  2. begin the line with double slashes (/ /)

  3. begin and end the line with double hyphens (-_-)

  4. indent the line

  5. None of these

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

C++ uses double forward slashes (//) to indicate single-line comments. Everything after // on that line is treated as a comment and ignored by the compiler. Multi-line comments use /* */ syntax.

Multiple choice
  1. Define the attribute as required

  2. Define subtypes

  3. Define each attribute as having an initial value that is recognized as blank

  4. Define supertypes

  5. None of these

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

Supertypes are more general entity types that contain subtypes. Defining supertypes doesn't address null value ambiguities - null ambiguities are typically resolved by defining attributes as required, setting default/initial values, or using subtypes to categorize data more precisely.