Which of the following is an example of a bijective function?
Correct: B, a bijective function is both one-to-one and onto
Which of the following is NOT a type of database model?
Correct: D, stack-based is not a database model
Which SQL command is used to retrieve data from a database?
Correct: C, SELECT is used to fetch data from a database
Which keyword is used to define a function in Python?
Correct: B, def is used to define functions in Python
Which of the following best describes a Deterministic Finite Automaton (DFA)?
Correct: D, DFAs have a unique transition per input symbol and accept regular languages
Which of the following sets is countably infinite?
Correct: A, the set of prime numbers is countably infinite, while others are uncountable
What is the primary function of a database management system (DBMS)?
Correct: B, a DBMS organizes and manages structured data
Which SQL function is used to count the number of rows in a table?
Correct: A, COUNT() returns the number of rows in a table
Which Python library is commonly used for working with databases?
Correct: C, SQLite3 is used for working with databases in Python
How does a DFA differ from a Non-deterministic Finite Automaton (NFA)?
Correct: B, NFAs can have ε-transitions while DFAs cannot
What is the result of the logical expression: (A ∨ B) ∧ (¬ A)?
Correct: B, if A is false, then only B determines the outcome
Which of the following is NOT a characteristic of a relational database?
Correct: B, key-value pairs are used in NoSQL databases
What does the following SQL statement do?
SELECT name, age FROM students WHERE age > 20 ORDER BY age DESC;
Correct: B, it retrieves students older than 20 and sorts them by age in descending order
Which of the following is a mutable data type in Python?
Correct: C, lists are mutable while tuples and strings are immutable
What is the minimum number of states required in a DFA that accepts strings of length exactly 3 over the alphabet {0,1}?
Correct: C, since we need to track exactly three input symbols, we require four states: one for the initial state and three to count the length
In a graph, what is the minimum number of edges needed to connect all vertices without forming a cycle?
Correct: B, this forms a spanning tree with n−1 edges
What is the main purpose of an index in a database?
Correct: C, indexing improves search efficiency
What is the purpose of the SQL GROUP BY clause?
Correct: C, GROUP BY is used for aggregating data
What will be the output of the following Python expression?
pythonCopyEdit
Correct: B, an empty list evaluates to False in Boolean context
What happens if a DFA encounters an input symbol for which there is no transition from the current state?
Correct: B, DFAs must have a defined transition for every symbol, or the input is rejected
What is the number of edges in a complete graph Kn?
Correct: C, each vertex connects to every other vertex exactly once
What type of join retrieves only matching records from both tables?
Correct: A, INNER JOIN returns only matching records from both tables
What will happen if you try to insert a NULL value into a column defined as PRIMARY KEY?
Correct: C, a PRIMARY KEY cannot have NULL values
What will be the output of the following Python code?
print(type([]))
Correct: A, [] is an empty list in Python
If a DFA has nnn states, what is the maximum number of transitions it can have for an alphabet of size Σ?
Correct: C, every state has exactly one transition per input symbol, so the maximum is n×|Σ|