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

  2. Control statement

  3. Exception

  4. Breakpoint

  5. Stack trace

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

In software development, a breakpoint is an intentional stopping or pausing place in a program, put in place for debugging purposes.More generally, a breakpoint is a means of acquiring knowledge about a program during its execution. During the interruption, the programmer inspects the test environment (general purpose registers, memory, logs, files, etc.) to find out whether the program is functioning as expected. In practice, a breakpoint consists of one or more conditions that determine when a program's execution should be interrupted.

Multiple choice
  1. u = x + 10 and v = y

  2. u = x + 10 and v $\ne$ y
  3. u + 10= x and v = y

  4. u + 10 = x and v $\ne$ y
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Initial value of a is 10 and its address and the value of 'a' would be different for both the parent and child processes. So, (1) and (2) are incorrect. Also, parent process executes a = a − 5 = 5 = u and child executes a = a + 5 = 15 = x. Therefore, u + 10 = x.

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.