MCQ Questions
MCQ Questions
MCQ Questions
FINANCE
7. What does the "FED" stand for in the context of financial markets?
a) Federal Economic Department
b) Financial Evaluation Division
c) Federal Reserve System
d) Financial Enforcement Directorate
DSA :
Certainly! Here are some hard-level multiple-choice questions based on data structures and
algorithms:
1. What is the time complexity of finding the kth smallest element in an unsorted array using
the QuickSelect algorithm in the average case?
a) O(n log n)
b) O(n)
c) O(n^2)
d) O(log n)
2. Which of the following data structures is typically used to implement a priority queue
efficiently?
a) Linked List
b) Stack
c) Heap
d) Hash Table
4. What is the worst-case time complexity of searching in a binary search tree (BST) if it's
unbalanced?
a) O(n)
b) O(log n)
c) O(n log n)
d) O(n^2)
5. Which sorting algorithm has the best average-case time complexity among the following?
a) Bubble Sort
b) Insertion Sort
c) Merge Sort
d) Quick Sort
6. What is the space complexity of Depth-First Search (DFS) algorithm when implemented
recursively on a graph with V vertices and E edges?
a) O(V)
b) O(E)
c) O(V + E)
d) O(log V)
7. Which of the following data structures provides constant-time access to the maximum (or
minimum) element?
a) Queue
b) Stack
c) Priority Queue
d) Linked List
8. What is the time complexity of Floyd-Warshall algorithm for finding all-pairs shortest paths
in a weighted graph with V vertices?
a) O(V log V)
b) O(V^2 log V)
c) O(V^3)
d) O(E log V)
9. Which data structure is typically used to implement Kruskal's algorithm for finding the
minimum spanning tree of a graph?
a) Heap
b) Stack
c) Priority Queue
d) Disjoint Set (Union-Find)
10. What is the time complexity of the Knuth-Morris-Pratt (KMP) algorithm for string
matching?
a) O(m + n)
b) O(m log n)
c) O(m * n)
d) O(m)
C / C++
Sure, here are some hard-level multiple-choice questions based on C and C++
programming:
#include <stdio.h>
int main() {
int i = 5;
printf("%d", i++);
printf("%d", ++i);
return 0;
}
a) 56
b) 67
c) 65
d) 76
3. In C++, what is the difference between "new" and "malloc()" when allocating memory?
a) "new" returns a pointer to an array of contiguous memory, while "malloc()" returns a
pointer to a single block of memory
b) "new" automatically initializes the allocated memory, while "malloc()" does not
c) "new" throws an exception if memory allocation fails, while "malloc()" returns NULL
d) "new" is used for dynamic memory allocation in C++, while "malloc()" is used in
C
```cpp
#include <iostream>
using namespace std;
class Base {
public:
virtual void display() { cout << "Base\n"; }
};
class Derived : public Base {
public:
void display() { cout << "Derived\n"; }
};
int main() {
Base *ptr = new Derived();
ptr->display();
delete ptr;
return 0;
}
```
a) Base
b) Derived
c) Compiler Error
d) Runtime Error
```c
#include <stdio.h>
int main() {
char *ptr = "Hello";
printf("%c\n", *ptr++);
printf("%c\n", ++*ptr);
printf("%s\n", ptr);
return 0;
}
```
a) H
I
ello
b) H
I
llo
c) H
I
ello
d) Compiler Error
8. In C++, what is the difference between "delete" and "delete[]" when deallocating
dynamically allocated memory?
a) There is no difference; both are used interchangeably
b) "delete" is used to deallocate memory allocated using "new", while "delete[]" is
used to deallocate memory allocated using "new[]"
c) "delete" is used to deallocate memory allocated using "malloc()", while "delete[]" is used
to deallocate memory allocated using "calloc()"
d) "delete[]" is used to deallocate memory allocated using "malloc()", while "delete" is used
to deallocate memory allocated using "calloc()"
9. What does the "static" keyword mean when applied to a variable in C or C++?
a) It specifies that the variable's value cannot be modified
b) It specifies that the variable is allocated memory in the heap
c) It specifies that the variable is accessible only within the current file
d) It specifies that the variable retains its value between function calls
SQL
Certainly! Here are some hard-level multiple-choice questions based on SQL:
1. Which of the following SQL queries correctly retrieves the second highest salary from an
Employee table named "Employees"?
b) `SELECT TOP 1 Salary FROM (SELECT DISTINCT TOP 2 Salary FROM Employees
ORDER BY Salary DESC) AS SecondHighest ORDER BY Salary ASC;`
c) `SELECT Salary FROM Employees ORDER BY Salary DESC LIMIT 1 OFFSET 1;`
2. Consider two tables: "Employees" and "Departments". What is the correct SQL query to
retrieve the department name(s) along with the count of employees in each department,
including departments with zero employees?
3. Which SQL keyword is used to remove duplicates from the result of a SELECT query?
a) UNIQUE
b) DISTINCT
c) DIFFERENCE
d) DISTINCTROW
Employees:
| EmployeeID | EmployeeName | DepartmentID |
|------------|--------------|--------------|
|1 | Alice | 101 |
|2 | Bob | 102 |
|3 | Charlie | 101 |
Departments:
| DepartmentID | DepartmentName |
|--------------|----------------|
| 101 | HR |
| 102 | IT |
What will be the result of the SQL query: `SELECT EmployeeName FROM Employees
WHERE DepartmentID = 101 UNION SELECT DepartmentName FROM Departments
WHERE DepartmentID = 101;`?
a) Alice, HR
b) HR, Alice
d) Alice, HR, HR
5. Which SQL query would you use to find the third highest salary from an "Employees"
table?
a) `SELECT TOP 1 Salary FROM (SELECT DISTINCT TOP 3 Salary FROM Employees
ORDER BY Salary DESC) AS ThirdHighest ORDER BY Salary ASC;`
b) `SELECT Salary FROM Employees ORDER BY Salary DESC LIMIT 1 OFFSET 2;`