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

  2. FIFO

  3. LILO

  4. None of these

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

A stack is defined by its LIFO (Last In First Out) access pattern.

Multiple choice
  1. evaluate an arithmetic expression in postfix form

  2. implement recursion

  3. convert a given arithmetic expression in infix form to its equivalent postfix form

  4. allocate resources (like CPU) by the operating system

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

While stacks are used for expression evaluation and recursion, resource allocation (like CPU scheduling) is typically handled by queues to ensure fairness.

Multiple choice
  1. For … Next Statement

  2. Do… While Statement

  3. If …Then Statement

  4. None of these

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

In Visual Basic, the If...Then statement is a conditional selection statement used to execute code based on whether a condition is true or false. The other listed options, such as For...Next and Do...While, are looping or iteration statements rather than selection statements.

Multiple choice
  1. Dim arrstu (20) as Integer

  2. Dim arr(k) as Double

  3. Dim arrstu ( 1 To 20) as String

  4. Dim arrstu (2)

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

Option B uses a variable 'k' inside the array declaration without it being defined or constant, which is invalid in standard VB array declarations.

Multiple choice
  1. Private Sub Month( )

  2. Call Month ( )

  3. Sub Dis_statement ( ) As Integer

  4. Sub FindError (intsal as Integer)

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

Option D is a valid Sub-procedure declaration with a parameter. Option A is also valid, but D is more descriptive of a procedure with parameters.

Multiple choice
  1. They use dynamic allocation for variable

  2. They use static allocation for variable

  3. Stacks are not available on all machines

  4. It is not possible to implement recursion on all machine

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

Recursion requires a new set of local variables for each function call, which is managed by dynamic allocation on the stack.

Multiple choice
  1. It increases the running time of programs

  2. It makes program verification difficult

  3. It increases the memory required for programs

  4. It results in compiler generating larger machine code

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

The goto statement creates non-linear control flow, making it difficult to trace the state of the program and verify its correctness.