# GATE Mock Test 3 and 4 - Programming, Data Structures, and Algorithms

Last Updated: 26th October, 2023

1. Who founded Python?

1. Alexander G. Bell
2. Vincent Van Gogh
3. Leonardo da Vinci
4. Guido van Rossum

d. The idea of Python was conceived by Guido van Rossum in the later 1980s.

2. What is the type of programming language supported by Python?

1. Object-oriented
2. Functional programming
3. Structured programming
4. All of the above

d. Python is an interpreted programming language, supporting object-oriented, structured, and functional programming.

3. Which among the following is the queue data structure’s applications?

1. When among the many or multiple users, a resource is shared.
3. When the transferring of the data is asynchronous
4. All of the above

4 All the above as all these features are the applications of queue type of data structure

4. What is the time complexity of finding an element in a Python list using the **in** operator?

1. O(n)
2. O(log n)
3. O(1)
4. O(n^2)

A. O(n)

Explanation: The **in** operator in Python performs a linear search in a list, resulting in a time complexity of O(n) in the worst case.

5. Which sorting algorithm has the best average-case time complexity in Python?

1. Quick Sort
2. Merge Sort
3. Bubble Sort
4. Insertion Sort

A. Quick Sort

Explanation: Quick Sort has an average-case time complexity of O(n log n), which makes it more efficient on average compared to the other sorting algorithms listed.

6. What is the worst-case time complexity of the binary search algorithm in a sorted list of size n?

1. O(log n)
2. O(n)
3. O(1)
4. O(n log n)

A. O(log n)

Explanation: Binary search has a worst-case time complexity of O(log n) because it divides the search space in half with each comparison.

7. Which algorithm is used to find the shortest path in a weighted directed graph with non-negative weights?

1. Depth-First Search (DFS)
3. Dijkstra's algorithm
4. Kruskal's algorithm

C. Dijkstra's algorithm

Explanation: Dijkstra's algorithm is used to find the shortest path in a weighted graph with non-negative weights.

8. Which database term is used to describe the rules that govern the relationships between tables in a relational database?

1. Schema
2. Index
3. Query
4. Constraints

D. Constraints

Explanation: Constraints in a relational database define rules and relationships between tables, such as primary keys, foreign keys, and unique constraints.

9. Which type of join returns only the rows that have matching values in both tables being joined?

1. INNER JOIN
2. LEFT JOIN
3. RIGHT JOIN
4. FULL OUTER JOIN

A. INNER JOIN

Explanation: INNER JOIN returns only the rows with matching values in both tables.

10. In a relational database, what does ACID stand for?

1. Atomicity, Consistency, Isolation, Durability
2. Association, Concurrency, Isolation, Dependency
3. Atomicity, Concurrency, Isolation, Dependency
4. Association, Consistency, Isolation, Durability

A. Atomicity, Consistency, Isolation, Durability

Explanation: ACID stands for Atomicity, Consistency, Isolation, and Durability, which are properties that ensure the reliability of database transactions.

Module 4: Database Management and WarehousingGATE Mock Test 3 and 4 - Programming, Data Structures, and Algorithms

Top Tutorials

Related Articles