0% found this document useful (0 votes)
3 views10 pages

Advanced QSAM Practice Questions

Uploaded by

nourkaroui2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views10 pages

Advanced QSAM Practice Questions

Uploaded by

nourkaroui2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Advanced QSAM Practice Questions

SQL
1. Which of the following SQL clauses is used to combine rows from multiple queries?

A. UNION

B. INTERSECT

C. JOIN

D. ALL

2. What does the ROW_NUMBER() function do in SQL?

A. Returns the total number of rows

B. Assigns a unique number to each row based on a specified order

C. Counts distinct rows

D. Returns rows matching a condition

3. Which statement creates an index on a column in SQL?

A. CREATE INDEX idx_name ON table_name(column_name);

B. CREATE idx_name FROM column_name;

C. INDEX column_name;

D. ADD INDEX idx_name ON column_name;

4. What does the EXPLAIN keyword do in SQL?

A. Executes a query

B. Provides metadata about a database

C. Generates the query execution plan

D. Validates SQL syntax

5. Which of the following is true about SQL transactions?

A. A transaction always consists of a single query.

B. Transactions ensure ACID properties.

C. Transactions cannot be rolled back.


D. Transactions are not supported in NoSQL databases.

6. How would you select the top 5 employees with the highest salaries in SQL?

A. SELECT * FROM employees ORDER BY salary DESC LIMIT 5;

B. SELECT TOP 5 * FROM employees ORDER BY salary;

C. SELECT FROM employees LIMIT 5;

D. FETCH 5 ROWS employees BY salary;

7. What does the HAVING clause do?

A. Filters rows before aggregation.

B. Filters rows after aggregation.

C. Groups rows into partitions.

D. Orders the results of a query.

8. What is the difference between LEFT JOIN and INNER JOIN?

A. LEFT JOIN returns unmatched rows from the right table.

B. INNER JOIN returns unmatched rows from the left table.

C. LEFT JOIN returns all rows from the left table, matched or not.

D. Both return all unmatched rows.

9. Which SQL window function is used to calculate running totals?

A. LEAD()

B. LAG()

C. ROW_NUMBER()

D. SUM() OVER()

10. What does the COALESCE function do?

A. Combines rows into one.

B. Returns the first non-NULL value from a list.

C. Generates a unique ID.

D. Checks for duplicate rows.


Python
1. Which library is used for data manipulation and analysis?

A. NumPy

B. Pandas

C. Scikit-learn

D. Matplotlib

2. What does the 'lambda' keyword define in Python?

A. A loop

B. A function

C. A variable

D. A class

3. Which method removes duplicate rows from a Pandas DataFrame?

A. drop_duplicates()

B. unique()

C. remove_duplicates()

D. filter_duplicates()

4. What does np.dot() do in NumPy?

A. Performs dot product of two arrays

B. Concatenates arrays

C. Generates a diagonal matrix

D. Finds the determinant of a matrix

5. Which of these is a generator in Python?

A. list(range(10))

B. (x for x in range(10))

C. [x for x in range(10)]

D. range(10)

6. What does sklearn's train_test_split() function do?


A. Splits a dataset into training and testing sets.

B. Splits a DataFrame into smaller DataFrames.

C. Splits a list into halves.

D. Splits features and target variable.

7. What is the default value of the axis parameter in Pandas?

A. 0 (row-wise)

B. 1 (column-wise)

C. None

D. It depends on the method.

8. Which Python library is primarily used for natural language processing?

A. NLTK

B. OpenCV

C. TensorFlow

D. Scikit-learn

9. What does the .apply() function in Pandas do?

A. Applies a function to each row or column.

B. Applies a filter to a DataFrame.

C. Applies a sorting function to a DataFrame.

D. Applies a function to the entire DataFrame.

10. What does the 'yield' keyword do in Python?

A. Defines a generator

B. Ends a function

C. Returns a value

D. Creates a class

Algorithmics
1. What is the time complexity of the merge step in merge sort?
A. O(n^2)

B. O(n log n)

C. O(n)

D. O(log n)

2. Which data structure is used for Breadth-First Search?

A. Stack

B. Queue

C. Linked List

D. Hash Table

3. What is the purpose of the dynamic programming approach?

A. Divide the problem into subproblems.

B. Store results of overlapping subproblems to avoid recomputation.

C. Optimize recursive algorithms.

D. Both B and C.

4. Which graph traversal algorithm guarantees the shortest path in unweighted graphs?

A. Depth-First Search

B. Breadth-First Search

C. Dijkstra's Algorithm

D. Bellman-Ford

5. What is the space complexity of a recursive algorithm with depth n?

A. O(n)

B. O(log n)

C. O(1)

D. O(n^2)

6. Which of these algorithms is not greedy?

A. Kruskal's Algorithm

B. Prim's Algorithm
C. Dijkstra's Algorithm

D. Bellman-Ford

7. What is the key difference between a min-heap and a max-heap?

A. Min-heap has smaller elements on top.

B. Max-heap has smaller elements on top.

C. Min-heap is sorted in ascending order.

D. Max-heap cannot store duplicates.

8. What is a spanning tree?

A. A tree connecting all vertices in a graph.

B. A tree with the shortest path between two vertices.

C. A subgraph with cycles.

D. None of the above.

9. What is the Big-O complexity of heap sort?

A. O(n log n)

B. O(n)

C. O(n^2)

D. O(log n)

10. Which algorithm uses backtracking?

A. Bubble Sort

B. Merge Sort

C. N-Queens Problem

D. Quick Sort

Cognitive Ability
1. Which number replaces the question mark in the series: 5, 9, 17, 33, ?

A. 37

B. 49
C. 65

D. 41

2. If a train travels 60 miles in 2 hours, what is its average speed?

A. 30 mph

B. 60 mph

C. 120 mph

D. 15 mph

3. A cube has how many edges?

A. 8

B. 12

C. 6

D. 16

4. Which word is a synonym of 'aberration'?

A. Deviation

B. Standard

C. Unity

D. Similarity

5. What is the next number in the Fibonacci sequence: 3, 5, 8, 13, ?

A. 18

B. 20

C. 21

D. 24

6. Which shape has the smallest number of vertices?

A. Square

B. Triangle

C. Hexagon

D. Pentagon
7. What is the area of a rectangle with length 6 and width 3?

A. 12

B. 18

C. 24

D. 36

8. Which of these is a prime number?

A. 9

B. 15

C. 19

D. 21

9. If x > y and y > z, then:

A. x > z

B. x = z

C. x < z

D. Cannot be determined

10. What is the sum of angles in a triangle?

A. 90°

B. 180°

C. 360°

D. 120°
Answers
SQL

1. A

2. B

3. A

4. C

5. B

6. A

7. B

8. C

9. D

10. B

Python

1. B

2. B

3. A

4. A

5. B

6. A

7. A

8. A

9. A

10. A

Algorithmics

1. C

2. B
3. D

4. B

5. A

6. D

7. A

8. A

9. A

10. C

Cognitive Ability

1. C

2. A

3. B

4. A

5. C

6. B

7. B

8. C

9. A

10. B

You might also like