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. cin and cout

  2. printf and scanf

  3. fprintf and fscanf

  4. all of the above

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

cin and cout set is the combination of format free input/output statement. Because here field width cannot be specified.

Multiple choice
  1. a variable, the value of which keeps on changing through out the program

  2. a variable, the value of which increase in a uniform order

  3. a variable, the value of which decreases constantly

  4. a variable, the value of which remains constant through out the program

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

A static variable in C++ retains its value between function calls and is initialized only once. It exists for the entire program duration, maintaining its value throughout execution. Unlike automatic variables, static variables do not get re-initialized on each function call.

Multiple choice
  1. Postfix operators can appear only on the right side of the operand.

  2. A postfix operator first changes the value of its operand before taking its value.

  3. A postfix operator first fetches the value and then increments it.

  4. Postfix operators cannot be overloaded.

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

Postfix operators return the original value before applying the operation. For example, i++ in an expression returns the current value of i, then increments i afterward, unlike prefix operators that modify first.

Multiple choice
  1. The stack pointer (SP) is used to hold the address of top of element of the stack.

  2. A stack can be implemented in a random access memory (RAM) attached to a CPU.

  3. A stack is incremented after fetching an instruction.

  4. A stack can be arranged in a collection of registers.

  5. None of the above

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

This is a false statement as the Program Counter register is incremented on fetching of the instruction.