EDPT (Electronic Data Processing Test) Quiz 5 — Questions and Answers
Question 1: Which of the following describes an algorithm with O(n²) time complexity?
- Execution time doubles when input size doubles
- Execution time increases proportionally to the square of the input size (Correct answer)
- Execution time is constant regardless of input
- Execution time grows logarithmically with input size
Correct answer: Execution time increases proportionally to the square of the input size
O(n²) means execution time grows proportionally to the square of the input size n.
Question 2: In the context of databases, what does 'normalization' primarily aim to reduce?
- Query execution time
- Data redundancy and update anomalies (Correct answer)
- Number of user accounts
- Storage encryption overhead
Correct answer: Data redundancy and update anomalies
Normalization organizes database tables to minimize data redundancy and prevent insertion, update, and deletion anomalies.
Question 3: A switch statement evaluates a variable with value 3. Cases are defined for 1, 2, and 4. What typically happens?
- The program crashes
- The default case executes (if defined) (Correct answer)
- Case 2 executes as the closest match
- Case 4 executes as the next match
Correct answer: The default case executes (if defined)
When no case matches, a switch statement executes the default block if one exists.
Question 4: What is the purpose of a checksum in data transmission?
- To encrypt transmitted data
- To verify data integrity by detecting transmission errors (Correct answer)
- To compress data before sending
- To route data packets to the correct destination
Correct answer: To verify data integrity by detecting transmission errors
A checksum is a calculated value appended to data that the receiver uses to detect errors introduced during transmission.
Question 5: How many bytes are in 1 kilobyte (KB) using the standard binary definition?
- 1,000
- 512
- 1,024 (Correct answer)
- 2,048
Correct answer: 1,024
In binary computing, 1 kilobyte = 2¹⁰ = 1,024 bytes.
Question 6: Which logic gate produces an output of 1 only when both inputs are 0?
- AND
- OR
- NOR (Correct answer)
- NAND
Correct answer: NOR
A NOR gate outputs 1 only when all inputs are 0 — it is an inverted OR gate.
Question 7: In programming, what is a 'variable scope' issue?
- A variable that is too large for its data type
- Accessing a variable outside the region where it is defined (Correct answer)
- A variable name that conflicts with a reserved keyword
- Assigning a string value to a numeric variable
Correct answer: Accessing a variable outside the region where it is defined
A scope issue occurs when code attempts to access a variable outside the block or function where it was declared.
Which of the following describes an algorithm with O(n²) time complexity?