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. address of operator

  2. value at address

  3. address of a variable

  4. none of these

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

The asterisk (*) operator, when used in pointer notation, is the dereference operator, which retrieves the value stored at the memory address held by the pointer.

Multiple choice
  1. 's' is a float variable

  2. 's' is going to contain a floating point value

  3. 's' contains the address of a floating point variable

  4. none of these

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

The declaration float *s defines s as a pointer to a float, meaning it holds the memory address where a float value is stored.

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