WorksheetsTechnical Aptitude Assessment
Total questions: 20
Worksheet time: 10mins
1. What is the output of the following C code? int main() { int a = 5, b = 10; printf("%d", a + b); return 0; } A) 15 B) 510 C) 5 D) 10
A) 15
C) 5 + 10
B) 15.0
A) 20
2. Which of the following is a valid declaration of a pointer in C? A) int *ptr; B) int ptr*; C) *int ptr; D) ptr int*;
int ptr;
A) int *ptr;
ptr* int;
*ptr int;
3. What will be the output of the following C code? int main() { int x = 10; printf("%d", ++x); return 0; } A) 10 B) 11 C) 12 D) Compilation error
D) Runtime error
C) 10
B) 11
A) 9
4. In C, which of the following is used to allocate memory dynamically? A) malloc() B) alloc() C) new() D) create()
calloc()
realloc()
A) malloc()
free()
5. What is the size of an int data type in C on a 32-bit system? A) 2 bytes B) 4 bytes C) 8 bytes D) 1 byte
B) 4 bytes
5 bytes
6 bytes
3 bytes
6. Which of the following is NOT a feature of Object-Oriented Programming in C++? A) Encapsulation B) Inheritance C) Polymorphism D) Compilation
Abstraction
D
Overloading
Debugging
7. What is the output of the following C++ code? class Test { public: void display() { cout << "Hello"; } }; int main() { Test t; t.display(); return 0; } A) Hello B) Error C) Hello World D) No output
A) Hello
C) Hello Universe
B) Compilation Error
D) Output is empty
8. In C++, which keyword is used to inherit a class? A) inherit B) extends C) implements D) :
F) subclass
D) :
G) baseclass
E) derive
9. What is the purpose of the 'virtual' keyword in C++? A) To create a virtual machine B) To allow method overriding C) To declare a constant D) To create a new thread
B) To allow method overriding
D) To manage memory allocation
C) To define a new data type
A) To implement garbage collection
10. Which of the following is a correct way to declare a property in C#? A) public int Property { get; set; } B) public int Property() C) int Property { get; set; } D) public Property int;
public int Property;
int Property() { }
private int Property { }
A) public int Property { get; set; }
11. What is the output of the following C# code? Console.WriteLine(5 + 10); A) 15 B) 510 C) 5 D) 10
A) 15
A) 25
C) 50
B) 15.0
12. In C#, which of the following is used to handle exceptions? A) try-catch B) if-else C) switch-case D) for-loop
A) try-catch
do-while
foreach
try-finally
13. What does the 'using' directive do in C#? A) Imports namespaces B) Declares variables C) Defines classes D) Creates methods
F) Handles exceptions
A) Imports namespaces
E) Manages memory
G) Executes code
14. Which of the following is a valid SQL statement to retrieve all records from a table named 'Employees'? A) SELECT * FROM Employees; B) GET * FROM Employees; C) RETRIEVE * FROM Employees; D) FETCH * FROM Employees;
QUERY * FROM Employees;
A) SELECT * FROM Employees;
PICK * FROM Employees;
LOAD * FROM Employees;
15. What will be the output of the following SQL query? SELECT COUNT(*) FROM Employees; A) Total number of employees B) Error C) 0 D) All employee names
List of employee IDs
Average age of employees
Total salary of employees
A) Total number of employees
16. Which SQL clause is used to filter records? A) WHERE B) SELECT C) FROM D) ORDER BY
A) WHERE
JOIN
GROUP BY
HAVING
17. In SQL, which of the following is used to update existing records in a table? A) MODIFY B) UPDATE C) CHANGE D) SET
ALTER
REMOVE
B) UPDATE
INSERT
18. What is the purpose of the 'async' keyword in ASP.NET Core? A) To run code synchronously B) To define asynchronous methods C) To create new threads D) To handle exceptions
C) To improve application security
D) To optimize database connections
A) To execute tasks in parallel
B) To define asynchronous methods
19. Which of the following is a valid way to create a new controller in ASP.NET Core? A) public class HomeController : Controller B) class HomeController : BaseController C) public HomeController() D) Controller HomeController;
A) public class HomeController : Controller
public void HomeController()
class HomeController : ControllerBase
public class HomeController : BaseController
20. What is the default method for handling HTTP GET requests in ASP.NET Core? A) Get() B) Post() C) Index() D) Retrieve()
Fetch()
Load()
Query()
A) Get()
