Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

1

PROGRAMMING QUESTION
Time – 1hour

1. Consider a table named "Employees" with columns "EmployeeID," "FirstName," "LastName," and
"DepartmentID." Which SQL query will retrieve the count of employees in each department, sorted in
descending order of the department's employee count?

a) SELECT DepartmentID, COUNT(EmployeeID) AS EmployeeCount FROM Employees GROUP BY


DepartmentID ORDER BY EmployeeCount DESC;
b) SELECT DepartmentID, COUNT(*) AS EmployeeCount FROM Employees GROUP BY
DepartmentID ORDER BY EmployeeCount DESC;
c) SELECT COUNT(EmployeeID) AS EmployeeCount FROM Employees GROUP BY DepartmentID
ORDER BY EmployeeCount DESC;
d) SELECT EmployeeID, DepartmentID, COUNT(*) AS EmployeeCount FROM Employees ORDER BY
EmployeeCount DESC;

2. Given a table named "Students" with columns "StudentID," "Name," and "Score," which SQL query
will return the names of students who scored higher than the average score?

a) SELECT Name FROM Students WHERE Score > AVG(Score);


b) SELECT Name FROM Students WHERE Score > (SELECT AVG(Score) FROM Students);
c) SELECT Name FROM Students HAVING Score > AVG(Score);
d) SELECT Name FROM Students HAVING Score > (SELECT AVG(Score) FROM Students);

3. Consider a table named "Products" with columns "ProductID," "ProductName," "CategoryID," and
"Price." Which SQL query will retrieve the product names and their respective categories for products
that have a price higher than the average price of all products?

a) SELECT ProductName, CategoryID FROM Products WHERE Price > AVG(Price);


b) SELECT ProductName, CategoryID FROM Products HAVING Price > AVG(Price);
c) SELECT ProductName, CategoryID FROM Products WHERE Price > (SELECT AVG(Price) FROM
Products);
d) SELECT ProductName, CategoryID FROM Products HAVING Price > (SELECT AVG(Price) FROM
Products);

4. What will be the output of the following code snippet?

class Program

{static void Main()

{
2

int x = 10;

int y = 20;

Swap(ref x, ref y);

Console.WriteLine($"x: {x}, y: {y}");

static void Swap(ref int a, ref int b)

int temp = a;

a = b;

b = temp;

a) x: 10, y: 20
b) x: 20, y: 10
c) Compiler error
d) Runtime error

5. What will be the output of the following code snippet?

class Program

static void Main()

int x = 5;

int y = 7;

int result = Add(x, ref y);

Console.WriteLine($"x: {x}, y: {y}, result: {result}");

static int Add(int a, ref int b)

a += 2;
3

b += 3;

return a + b;

a) x: 5, y: 10, result: 20
b) x: 7, y: 10, result: 20
c) x: 5, y: 10, result: 17
d) x: 7, y: 10, result: 17

6. What is the output of the following JavaScript code?

console.log(2 + '2' - 1);

a) '21'
b) '221'
c) 3
d) 21

7. What is the result of the following JavaScript expression?

typeof null;

a) 'null'
b) 'object'
c) 'undefined'
d) 'string'

8. Which of the following is a valid way to define a JavaScript array?

a) var arr = [1, 2, 3];


b) var arr = new Array(1, 2, 3);
c) var arr = {1, 2, 3};
d) var arr = Array(1, 2, 3);

9. What is the output of the following JavaScript code?

var x = 10;

console.log(x++);

a) 10
b) 11
c) 9
4

d) NaN

10. Which built-in JavaScript method is used to convert a string to an integer?

a) parseInt()
b) parseFloat()
c) toString()
d) toInteger()

11. Which of the following is a valid way to handle exceptions in C#?

a) try-catch-finally
b) if-else
c) switch-case
d) for loop

12. Which of the following is the base class for all classes in the .NET Framework?

a) System.Object
b) System.Type
c) System.Base
d) System.Main

13. Which of the following is used to define the structure of a database in .NET?

a) Entity Framework
b) LINQ
c) ADO.NET
d) ASP.NET

14. In .NET, what does the acronym ASP.NET stand for?

a) Active Server Pages Network


b) Advanced System Programming Network
c) Application Server Pages Network
d) Active Server Pages.NET

15. What is the purpose of the using statement in C#?

a) It is used to declare variables.


b) It is used to define classes.
c) It is used to handle exceptions.
d) It is used to ensure proper disposal of resources.
5

IQ
1. Which word does not belong in the following group?

a) Radio
b) Television
c) Internet
d) Newspaper

2. If a train travels at a speed of 150 kilometers per hour, how far can it travel in 3 hours and 45
minutes?

a) 525 kilometers
b) 600 kilometers
c) 675 kilometers
d) 750 kilometers

3. If you rearrange the letters "TRIAN" to form a word, which word would you get?

a) TRAIN
b) RAIN
c) INTRA
d) RANT

4. If a rectangle has a perimeter of 60 units and one side measures 15 units, what is the length of the
other side?

a) 7.5 units
b) 12 units
c) 15 units
d) 17.5 units

5. Which is the next letter in the series: B, E, I, M, R, ___?

a) U
b) V
c) W
d) X

6. If it takes 6 workers 12 days to complete a project, how long would it take 12 workers to complete
the same project?

a) 3 days
b) 4 days
c) 6 days
d) d) 9 days
6

7. Which number should come next in the series: 5, 8, 13, 20, 29, ___?

a) 38
b) 40
c) 41
d) 45

8. What is the value of x in the equation: 5x + 8 = 33?

a) 4
b) 5
c) 6
d) 7

9. Which planet is known as the "Blue Planet"?

a) Earth
a) Jupiter
b) Saturn
c) Uranus

10. How many sides does an icosagon have?

a) 20
b) 21
c) 22
d) 23

You might also like