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 technology programming languages
  1. Quicksort

  2. Linear Search

  3. Bubble Sort

  4. none of the above

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

For 200,000 elements: Quicksort is O(n log n) ≈ 3.6M operations, Linear Search is O(n) = 200K operations, and Bubble Sort is O(n²) = 40B operations. Linear search is fastest, so you'd wait the least time for it.

Multiple choice technology programming languages
  1. friend

  2. virtual

  3. inline

  4. static

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

When a function is declared inline, the compiler attempts to replace the function call with the function's actual code at the calling location. This eliminates function call overhead. friend is for access, virtual for polymorphism, static for class-level sharing.

Multiple choice technology programming languages
  1. TRUE

  2. FALSE

  3. CAN'T SAY

  4. NONE OF THESE

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

The position() function in XPath and XSLT returns the context position - a number equal to the current node's position within the processed node sequence. For example, when processing a node-set with xsl:for-each, position() starts at 1 for the first node and increments for each subsequent node. This is commonly used for numbering items, creating alternating row styles, or processing specific nodes (like position() mod 2 = 0 for even-numbered items). The function always returns an integer representing the current context position.

Multiple choice technology testing
  1. True

  2. False

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

Function points are a software size measurement method based on the number and complexity of user-visible functions (inputs, outputs, inquiries, external interfaces, internal files). They do NOT measure lines of code - that would be LOC (Lines of Code) metrics. The two are different measurement approaches.

Multiple choice technology programming languages
  1. a

  2. *a

  3. &a

  4. address(a)

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

A pointer variable stores a memory address. When you declare int* a, the variable a itself holds an address. Accessing a returns that address value. Dereferencing (*a) gives the value at that address. Taking address of a (&a) gives the address where the pointer variable is stored, not the address it holds.