0% found this document useful (0 votes)
18 views3 pages

Question Bank - MTE

This document is a question bank for the OOPs with Java course, providing reference questions to help students prepare for exams. It covers various topics including Java features, object-oriented principles, control flow statements, and practical programming tasks. The questions range from theoretical concepts to practical programming exercises, encouraging a deep understanding of Java and its applications.

Uploaded by

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

Question Bank - MTE

This document is a question bank for the OOPs with Java course, providing reference questions to help students prepare for exams. It covers various topics including Java features, object-oriented principles, control flow statements, and practical programming tasks. The questions range from theoretical concepts to practical programming exercises, encouraging a deep understanding of Java and its applications.

Uploaded by

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

QUESTION BANK FOR MTE

Subject: OOPs with Java Course Code: R1UC201C


(Note to Students: The questions provided in this question bank are reference questions designed
to help you understand the pattern, level, and type of questions you may encounter in your
exams.
Please note: The same questions may not appear in the exam. However, you can expect similar
questions based on the concepts and formats practiced here. Focus on understanding each topic's
logic, syntax, and theory for best preparation.)

1. Explain the key features of Java that make it a platform-independent language.


2. Describe the differences between C++ and Java with examples.
3. Explain the role of JDK, JRE, and JVM in Java development and execution.
4. Differentiate between primitive and non-primitive data types in Java.
5. Discuss Java’s control flow statements with syntax and examples.
6. Define the concept of Object-Oriented Programming and list its four main principles.
7. What is the role of constructors in Java? How is a default constructor different from a
parameterized one?
8. Explain the difference between this and super keywords in Java with examples.
9. What is method overloading? How is it different from method overriding?
10. Discuss the concept of aggregation and how it differs from inheritance.
11. What is dynamic binding in Java? How does it enable runtime polymorphism?
12. Explain the use and rules of the final keyword in Java.
13. What is an abstract class in Java? How is it different from an interface?
14. Describe the concept of "instanceof" operator in Java with a code example.
15. What are the naming conventions followed in Java for classes, variables, and methods?
16. Write a Java program to print "Hello, Java!" and explain the internal details of how JVM
executes it.
17. Create a Java program using all arithmetic, relational, and logical operators with
meaningful examples.
18. Write a program to demonstrate the use of if-else, switch-case, and loops (for, while, do-
while).
19. Design a class Student with instance variables and methods. Create objects and access
members using dot notation.
20. Write a Java program to demonstrate constructor overloading.
21. Create a program using the static keyword for variables and methods. Explain the output.
22. Implement a class with the this keyword to call a constructor and resolve naming conflicts.
23. Write a program to demonstrate single and multilevel inheritance.
24. Create a Java program using aggregation to show HAS-A relationship between two classes.
25. Implement method overloading and overriding in two separate classes. Show how
polymorphism works at compile and runtime.
26. Write a program that uses super to call superclass constructor and method.
27. Demonstrate the use of instanceof in checking object types at runtime.
28. Create a class Employee that keeps a track of the number of employees in the
organization,total no of leaves of employees and also store their name,designation and
salary details. Create a method named display_count which print the Total no of
employees in the organization.Create a method named display_details which print the
Employee's informations(name,desiganation,salary,no_of leave)
29. Create an abstract class Shape with abstract method area(). Extend it in Circle and
Rectangle classes.
30. Write a Java program to show runtime polymorphism using base class reference and
subclass objects.
31. Design a program with a final class and method. Attempt to override the final method and
observe the behavior.
32. You are developing a Java application for an online gadget and apparel store called
“ShopSmart”. The store sells various electronic items and clothing. Each product has a
unique ID, a name, and a base price. Additionally, electronic products come with optional
warranty charges, while clothing items often have promotional discounts.

Task:

 Create a base class Product with attributes: productId, productName, and price. Initialize
them using a constructor and include a method calculateBill() that returns the base price.
 Create a subclass ElectronicProduct with an extra attribute warrantyCharge. Override
calculateBill() to return price + warrantyCharge.
 Create another subclass ClothingProduct with an extra attribute discount. Override
calculateBill() to return price - discount.
 In the main() method, simulate the billing system by creating one object each of
ElectronicProduct and ClothingProduct. Use dynamic method dispatch to display the total
bill for each product category.

33. You are tasked with building a smart calculator feature for a personal assistant app. The
calculator has to intelligently interpret the number of inputs and perform different
operations accordingly.

Task:

 Define a class SmartCalculator with a method add() that behaves differently based on the
number of arguments passed:
 If one argument is passed, treat it as a request to square the number and return the result.
 If two arguments are passed, add the numbers and return the sum.
 Demonstrate the usage of this feature by creating an object of SmartCalculator and calling
the add() method with both one and two arguments to simulate real-use scenarios.

34. Scenario:
You're creating a course enrollment system. The university offers online and offline
courses with varying fee structures.

Task:

 Create an abstract class Course with attributes: courseId, courseName, and baseFee.
Include an abstract method calculateFee().
 OnlineCourse has an additional attribute platformFee, which is added to the base fee.
 OfflineCourse has a labFee, which is added to the base fee.
 Implement the calculateFee() method in both subclasses.
 In the main() method, simulate the fee calculation for both types of courses using
abstract class reference.
35. Scenario:
A fitness center offers memberships for general fitness and personal training.

Task:

 Create a class Membership with memberName and baseFee.


 GeneralMembership includes an attribute groupClassFee.
 PersonalTrainingMembership includes an attribute trainerFee.
 Override the method calculateTotalFee() in both subclasses.
 In the main() method, use a Membership reference to invoke the method for both
types.

You might also like