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

  2. Case sensitivity is compiler-determined

  3. Yes

  4. None of the Above

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

This question lacks context, but C++ is a strictly case-sensitive programming language. Therefore, identifiers like myVar and myvar are treated as completely distinct.

Multiple choice technology programming languages
  1. True

  2. False

  3. It depends on the variable type

  4. None of the Above

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

This question lacks context, but in C++, whether a variable is automatically initialized or contains garbage values depends on its type and storage duration (e.g., global/static variables are zero-initialized, while local automatic variables are not).

Multiple choice technology programming languages
  1. The snippet is illegal

  2. It loops forever

  3. It is ignored by compiler, but it is not illegal

  4. None of the Above

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

This question lacks context, but like question 135521, it refers to an infinite loop construct (such as while(true) or for(;;)), which is syntactically legal and loops forever.

Multiple choice technology programming languages
  1. Breaks out of the if statement

  2. Exits the function

  3. Nothing (Compiler error)

  4. None of the Above

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

This question lacks context, but in C++, using a break statement outside of a loop or a switch block (such as directly inside an if statement) results in a compilation error.

Multiple choice technology programming languages
  1. public

  2. protected

  3. guarded

  4. None of the Above

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

This question lacks context, but 'guarded' is not a valid access specifier in C++. The standard C++ access specifiers are public, protected, and private. If the question asks for a non-C++ specifier, 'guarded' is correct.

Multiple choice technology programming languages
  1. True

  2. False

  3. It depends on the variable type

  4. None of the Above

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

In C++, true and false are bool keywords that convert to 1 and 0 respectively in integer contexts. However, the expression true == false is always false regardless of variable type because both are bool constants. The answer depends on context - for bool variables, only true and false values exist; for other types converted to bool, any non-zero value is true and zero is false.