Second Performance Test
Second Performance Test
2. Create a class Voter with an age field and a method CanVote() that returns a boolean indicating
if the person is eligible to vote (age >= 18).
3. Explain the concept of inheritance in Object-Oriented Programming (OOP). How does it help
with code reusability and maintainability? Provide 5 examples.
4. Create a Library Management System that will store the following information for each book:
Title (string), Author (string), ISBN (string), Year Published (integer). Store data for at least 5
books and print the information.
5. Create a table named Employee with the following columns and constraints:
6. Write the SQL INSERT INTO statements for inserting these 10 records.
7. Write a query to display all employee details whose EmpJob is either 'Manager', 'HR', or
'Trainer'.
8. Write a query to display the employees whose EmpSalary is between 60,000 and 70,000.
9. Write a query to display all employees whose salary is less than 60000.
10. Write a query Display all employees whose salary is greater than 65000.
11. Write a query to display all employees who are not Analysts.
12. Write a query to find employees whose salary is not entered yet (NULL)
13. Write a query to find employees whose names start with 'A'.
14. Write a query to Display all employees whose job title contains the word 'er' (e.g., 'Manager',
'Designer').
15. Write a query to Display employees whose job is not 'Developer', 'Tester', or 'Support'.
16. Write a query to List all employees who have a salary value entered (i.e., salary is not NULL).
17. Write a query to Display employees whose job is 'Trainer' and salary is greater than 50000.
18. Write a query to Find employees whose second letter in the name is 'a' (e.g., 'Sara', 'Mariam').
19. Write a query to display employees whose job is not one of the following: 'Coordinator',
'Consultant', 'Support'.
20. Write a query to Display all employees whose name has exactly 5 characters.
21. Write a Query Find employees whose job title starts with 'De' (e.g., 'Developer', 'Designer').
22. Write a query to display all employees sorted by EmpSalary in descending order.
23. Display employees sorted first by highest EmpSalary, and if salaries are equal, then sort by
EmpName.
24. Write a query to get the top 3 highest-paid employees.
25. Make the following changes in the Employee table
- Add a Primary Key constraint to the EmpID column (assuming EmpID is currently not a
primary key).
- Remove the Primary Key constraint (if any) from the EmpID column and add it to the
EmpJob column instead.