Fundamental Coding Skills Flashcards
7 cards from real Mettl practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Fundamental Coding Skills flashcards as text
What is a null pointer dereference?
Answer: Accessing memory at address zero or an uninitialized pointer
Dereferencing a null pointer attempts to access memory at an invalid address, usually causing a runtime crash.
Which of the following is an example of a syntax error?
Answer: Missing a closing parenthesis in code
A missing closing parenthesis violates the grammar rules of the language, making it a syntax error caught at compile/parse time.
What does the following pseudocode do? `for i from 1 to n: sum = sum + i`
Answer: Computes the sum of integers from 1 to n
The loop accumulates each integer from 1 to n into `sum`, computing the total sum of that range.
What is the difference between `==` and `===` in JavaScript?
Answer: `==` checks value only; `===` checks value and type
`==` performs type coercion before comparing, while `===` (strict equality) requires both value and type to match.
Which of the following best describes a binary search algorithm?
Answer: Searches by repeatedly halving the search interval on a sorted array
Binary search works on sorted arrays by comparing the target to the middle element and eliminating half the remaining elements each step.
What is an infinite loop?
Answer: A loop whose condition never becomes false
An infinite loop occurs when the loop's termination condition is never met, causing it to execute indefinitely.
In object-oriented programming, what does 'encapsulation' mean?
Answer: Bundling data and methods together and restricting direct access
Encapsulation bundles an object's data and the methods that operate on it, exposing only a controlled interface to the outside.