Object oriented programming (OOP) past paper

Object oriented programming (OOP) all previous/ past question papers

– Object oriented programming (OOP)-Computer Science all subject past paper Object oriented programming (OOP) –Computer Graphics  Course  Object oriented programming (OOP) Project idea – ICT  MCQ -Object oriented programming (OOP) Interview Question  –Computer Science all courses -Technology –University Past Paper -Programming language –Question paperold paper

Object oriented programming (OOP) Sessional I in 2020




Q-1: Answer the following questions. [2×5-10 Marks]

  1. Explain at least four usages of ‘this’ keyword with example.
  2. Explain these terms with example.
  3. abstract methods 2. concrete class
  4. access modifiers
  5. What is the difference between Procedural programming and Object-oriented programming? d. Write a Java class ‘Subject’ with three characteristics namely subject marks, subject name and subject code. Moreover, to implement this data write two methods, first to print the marks, name and code of each subject and second to print the average marks?
  6. Write a Java class to count the number of instantiated objects.

Object oriented programming (OOP) Sessional 2 2020




Q-1: Write three differences between inheritance and composition. [3 marks]

Q-2: Write a class Work whose objects represent working times (in minutes) and salary rates (in cents per minute). With this class, the following operation shall be possible: [5 marks]

// add 65 minutes working time

// prints salary (25*60 Cents)

// 30 cent/min, 0 min

// u becomes a copy of v

Q-4: Write a java code to implement the multiple inheritance. [5 marks]

// 25 cent/min, 60 min

Work w= new Work(25, 60);

w.add(65);

w.printSalary();

Q-3: Explain interfaces with example. [2 marks]

Work u(v);

Work v= new Work(30);

Object oriented programming (OOP) Final paper in 2020

Q-1: Explain the following terms: 12×5-10 Marks]

  1. Class 2. Object
  2. Access Specifier 4. Method overloading
  3. Constructor

Q-2: Explain why it is sometimes useful to overload a constructor. 15 Marks

Q-3: Using an object-oriented programming language with which you are familiar write a class hich contains a method called getNumberOfInstances. This method should return the number tersed the class 15 Marks!

Q-4: is the meaning of the keyword Static in Java? What are the differences between static and non-static members. 15 Marks]

Q-5: What is polymorphism? Give an example to illustrate the use of polymorphic variables in Java. 15 Marks]

Q-6: Designing an electronic voting machine is a challenging task. You are asked to implement a very simplified voting machine class with the following specification. A voting machine has a list of candidates and the following methods: 15 Marks a)

addCandidate(String name)/ Add a candidate with the name to the list / b) cast Vote(String name)

Cast a vote to the candidate with the name / c) printResults()

da pripmmber calcach cat lidate has received. The order does not matter Assume that only two attributes of a candidate, namely, the name and number of votes, are of interest here, and the size of the candidate list is unknown in advance.

Q-7: What is the benefit of Composition over Inheritance? [5 Marks]




Object oriented programming (OOP) past paper
Object oriented programming (OOP) past paper

Object oriented programming (OOP) Sessional I in 2018

Question 1: Write a program that has two numbers in main(), passes these numbers to a function that performs integer addition. And overload above function, that receives 2 floating values from main() and performs floating addition? (1.5+1.5)

Question 2: Write a program that makes a class to store age, salary of a Person. The program should define the member functions of that class to get the values and then set the values from the main(). Program should show the concept of information hiding? (2+2)

Question 3: Define a class named Distance with public attributes: (2+1) int feet; Pass the object to a function (call by value), that displays the both data members. The function should be inline function.

Type here to search

int inches;O

52°F Sunny

A60 440

Object oriented programming (OOP) Sessional II in 2020

Question 1:




a) Consider a class Person that has two attributes age (int) and height (float). Using this class, show the difference between constructor. default constructor. copy constructor and default copy constructor? (1-1-1-1)

b) Write a program that has a Box class with one attribute width (float). Make a function serwidth() to set the value and use a friend function display() to show the values of this class Box? (2-2)

Question 2: Imagine a publishing company that markets both book and audiocassette ver Create a class publication that stores the price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int). and tape. Which adds a playing time in minutes (type float). Each of these three classes should have a getdatat) function to get its data from the user at the keyboard, and a putdate() function to display its data.object Write a main() program to test the book and tape classes by creating instances of them. asking the user to fill in data with getdataf), and then displaying the data with putdate()22-2-2-1)

Object oriented programming (OOP) Final paper  in 2020

(a.) Make a program in java where the abstract class Myclass has one abstract method calculate() which has got implementation in the two sub classes square and cube. Square class calculates the square of number in calculate() method and cube class calculates cube. Use the both classes in the main() method to calculate the cube and square of a number? Note: There are no other data members and member functions besides calculate() in these three classes, calculate method has only one argument of integer type. (2+1+2+2+3)

b.) What is the difference between package, class, interface in java. Explain all the underlined parts of the following code of java? (3-7)

1. public static void main(String_args[]) {

2. System.out.println(“This is simple statement Tr 3. System.out.print(“This is the second statement”);

Question 2:

a.) Write a c++ program to determine the area of rectangle according to the length and width entered by the user in the main). Your code should include a template Selass T Area formula (area length width)? (5)

b.) What is the concept of overloading and overriding in java. write two programs one for overriding and other for overloading in jav.. Assume the method display() for overloading and overriding. First display simply shows the age of a person. And second display() which shows the age of a person with the message “younger” or “older” by checking the age of a person? (34)

Question 3:

a.) Write a java program that has men class inherited from person class. person class has one wissue data member age and a parametrized constructor that receives a variable et data member and a display() Junction to show the age, men class is inherited from person class and has private data member height and a parameterized constructor to receive input from main() and display function to show the data. Create men object in the main() to test this class? (1-1-2-1-1-1-2-1)

b.) Write a simple java program to calculate average of numbers entered by user. Take the input from the user by asking that “hoyy many number you want to enter then take the numbers as input and store them in array. Array size depends on the user input. Calculate the average and display the average of those number. Import the necessary classes if you need! (1-1-1-2-201




#Object oriented programming (OOP) #Computer Science all subject past paper  Object oriented programming (OOP) #Computer Graphics  Course  #Object oriented programming (OOP) Project idea  #Object oriented programming (OOP) MCQ  #Object oriented programming (OOP) Interview Question  #Computer Science all courses #Technology #University Past Paper #Programming language  #Question paper  #old paper

Scroll to Top