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. A restrict pointer ensures the only means by which the object it points to can be accessed.

  2. It ensures that the variable's value may be changed in ways not explicitly specified by the program.

  3. It ensures that we can not change objects of type const during program execution.

  4. It is not defined in C++.

  5. None of the above

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

This is a true statement about 'restrict' type qualifiers in C++.

Multiple choice
  1. To execute value of control variable multiple times.

  2. To read value for one-dimensional array statement.

  3. To execute value of outer variable to specified number of times in the inner loop.

  4. To get sum and average of 'N' numbers.

  5. To compare two strings.

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

This is the correct option as in the nested loop statement inner loop is repeated specified number of times for each value of control variable in the outer loop.

Multiple choice
  1. When we do not know the initial value for loop index variable.

  2. When we know value for loop index variable.

  3. When there is no test condition in the loop.

  4. When there is test condition in the beginning of the loop.

  5. When there is no increment statement in the loop.

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

This is the correct reason to make use of do-while loop in a program as the condition is verified at the end in do-while loop.

Multiple choice
  1. compile time error

  2. runtime error

  3. infinite loop

  4. none of these

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

An exception is an unwanted event that occurs during runtime and terminates the execution. Hence, an exception is nothing but a runtime error.

Multiple choice
  1. Wrongly written inbuilt function

  2. Divide by zero error

  3. Array out of index error

  4. File not found error

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

Wrongly written inbuilt function gives the error in compile time. All the rest are runtime errors.