Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
63 views
40 pages
Object Oriented Programing Dec 2010,2013,2016
Uploaded by
richardo forrester
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save OBJECT ORIENTED PROGRAMING DEC 2010,2013,2016 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
63 views
40 pages
Object Oriented Programing Dec 2010,2013,2016
Uploaded by
richardo forrester
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save OBJECT ORIENTED PROGRAMING DEC 2010,2013,2016 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 40
Search
Fullscreen
THE MICO UNIVERSITY COLLEGE QUESTION PAPER FORM ‘Course Code and Title: OBB Date: December 2010 Tie Duration 29 Hours semeste ti Semester summerSession Cl Supplemental © a Aprijimay july Material Required: Answer Booklet: Normal i Special o Notrequied == Caleulator: (where applicable) Programmable Non-programmable C1 Multiple Choice Answer Sheets: No ofitems: 1 Numerical = Alphabetical = | Ausilary/Other material: Please specity card 4 Instructions to Students: This paperhas 1 pagesand __10__ questions. Students are reminded that the examiners will take into account the proper use of the English Language in determining the mark for each response. SECTION A INSTRUCTION: Answer ALL questions in this section 1. Use the declaration of the class Student. and its prototypes, in C++, to answer the following questions. class Student { char name (50]; int age; long int idNumber; public Student () 7 void get_data (void); void set_data (char*, int, int);fa) (b) () (d) (e) (f (eg) (a) (b) What is the access specifier for the data members of Student? (1. mark) Identify the constructor for the Student class. (1. mark) Write PIECES of C++ codes for part(c) ~ (g) that: define the function set_data outside of the class. {6 marks) create TWO Student objectsMary and John. (mark) use the Student object Mary to set the data fora student name “Mary”, age, 20 and id number 20351. (2 marks) use the Student object John to output John’s data. {1 mark) declare a friend function of Student’ name newIdNumber that returns an integer and takes a Student object argument. (2 marks) Draw an inheritance hierarchy graph representing a typical university with thousands of people who are classified as Students. These students consist of Undergraduatestudent and Graduatestudent. UndergraduateStudents are classified as Freshman, Sophomore, Junior and Senior. AGraduateStudent canbe categorized asa DoctoralStudent ora Mastersgtudent. The university has a special programme that allows some Doctoral Student andMastersStudent to be Tutors. {6 marks) Show on your graph AN INSTANCE of the following: i. a single inheritance (1 mark) ii ‘a multiple inheritance {i mark) ili a superclass only (amark) iv. asubciass only (amark) v. asuperclass and subclass (1mar )SECTION B INSTRUCTION: Answer ALL questions in this section 3, (a) Object Oriented Programmers claim that the use of friend functions is NOT an object-oriented programming (OOP) methodology. Give ONE (1) reason for this claim and say how OOP programmers can correct this technique. (2 marks) (b) Explain briefly what is meant by encapsulation in Object Oriented Programming (oop). (3 marks) 4, The table below shows how we can summarize the different access types of members of a C++ class by according to who can access them: ee Access ublic [protected [private __yes Members of the same class Members of the derived class Not members Copy and complete the table by writing YES if access is possible and NO if not possible in the empty cells. Eg. i, Members of the same class CAN access public members, therefore yes is placed in the cell that correspond to public. (4 marks) 5. Explain, using pieces of code, what is polymorphism in OOP? (5 marks) 6. _ In JAVA, with the use of examples differentiate between: i subroutines and toolboxes (2 marks) ii, static and non-static methods (3 marks) vi. API's and packages? (2 marks) 7. ImaJava application, the main () subroutine must be declared to be both static and public. (a) Why must the main () routine be static? (Why does this requirement make sense?) (2 marks) (b) Why must the main () routine be public? (Why does this requirement make sense?) (2 marks)SECTION C INSTRUCTION: Candidates MUST Answer QUESTION 8 and ONE other question in this section, 8. Use the information given below, class Point { attributes: int x, y methods: setX (int newx) get () setY(int newY) getY() class Circle { attributes: int x, y, radius methods: setX (int newX) getx() setY¥(int newY) gety() setRadius (int newRadius) getRadius () : of the TWO classes and the INHERITANCE concept of objects to write: (2) C++ codes to define the TWO classes (b) JAVA codes to define the TWO classes. (25 marks)9. Suppose that you want a class (name HankAccount) to represent the money in a bank account, It needs FOUR methods: one to deposit a given amount into the account (called deposit that adds the amount received by the method to the balance and stores, it in balance) one to withdraw a given amount (called withdraw that subtract the amount received by the method from the balance and stores it in balance) * one to check how much money is in the account (called checkBalance that returns the balance), "and one to set the amount in a BankAccount. (called setAccount). © It also needs a constructor that creates an account containing a specified initial amount of money which is set to $0.00. © The class should have one instance variable called balance of type double, for storing the amount of money in the account, * Amain () subroutine, that: + creates a BankAccount object called firstAccount; + allows the user to set account balance + allows the user to make a deposit in the account * allows the user to make a withdrawal from the account + checks the balance in the account to determine if there is an overdraft on the account, if there is an overdraft the program should print “Sorry there is an overdraft on your account” otherwise the program should output the balance in the account. (N.B. overdraft means balance is below $0.00) Write a complete Java class satisfying these requirements. (25 marks) oR 10. Use the requirements above in QUESTION 9 to write a C+ program. (25 marks) END OF EXAMINATIONTHE MICO UNIVERSITY COLLEGE QUESTION PAPER FORM : . . . ] couse coseans te: Object Oriented Programming COMP 2001 | oa: December 2013 oe uration 2% Hours ey Semestertt Summer Session [supplemental Eemination Year 2013 perasy wy | atrial Required: Answer Boot ae Special o Notreuied = Cater (where appcble) Programmable Non programmable © Multiple cole ansior sheets No oftems: 1-20 huneieat = Aphabeial = | suxitiny/Other material Please specify Students are permitted to bring the following items to thelr desks: Pens; Pencils Ruler; Geometry Set; ID Card; Examination card Instructions to Students: This paperhas _8 pagesand _ 26__ questions. Answer ALL questions in section A and B AND ONLY ONE question from section C. Students are reminded that the examiners will take into account the proper use of the English Language in determining the mark for each response.SECTION A INSTRUCTIONS: (i) Answer ALL questions in this section (i) Choose the most appropriate response by shading the corresponding circle on the computerized answer sheet provided. Which of the following is use to access a member function from outside the class? (A) The class name (B) The dot operator (C)__ The open and close braces (D) The data member Which of the following would be attributes of car object? (A) drives, stops, accelerates and crashes (B) brakes, doors, wheels and seats (©) accelerates, doors, wheels and stops (D) colour, turns, wheels and doors In OOP relationships, what is a “is-a” relationship called? (A) composition (B) inheritance (C)__ polymorphism (D) object we format, void x :: s(t) (u) can be used to define a method. Which letter represents the class name? (A) @®) © ) Which of the following statements are TRUE about structures? Eoan i, Members of the same structure must have unique names, Different structures may NOT contain members with the same name. A structure may consist of other structures. A structure cannot contain an instance of elf. (A) ionly @) (©) _ iiiandivonly (D) ivi, iv only10. ML. Which of the following is NOT TRUE when declaring data members? (A) They can be anywhere in the class. (B) They can be constants or static. (C) They must have an access specifier. (D) They can be other objects. Use the following information to answer questions 79. i. public members ii. private members iii. protected members Which members can other members that are not of a particular class access? (A) ionly (B) _ itonly (C)__ iand iii only (D) _ iiandiii only Which members can members of the same class access? (A) ionly (B) iionly (©) iand ii only (D) i, itand iii Which members can members of a derived class access? (A) ionly (B) _ iti only (©) iand ifi only (D) i, ivandiii What is a function that is specified by placing =0 at the end of its prototype in the class definition called? (A) _ inheritance (B) pure virtual function (C) zero function (D) polymorphism Assuming that text is a variable of type st ring, what will be the contents of text after the statement cin >> text; is executed if the user types “Hello World!” then presses Enter? (Ayo (B) "Hello" (C) "Hello world" (D) "Hello world!"12. 13, 14. 15. 16. 17, Use the inheritance graph below to answer questions 12 ~ 14, 7] In the figure above, which of the following BEST describes X? (A) superclass only (B) subclass only (©) superclass and subclass (D) — multiple inheritance In the figure above, which of the following BEST describes Y? (A) superclass only (B) subclass only (C) superclass and subclass (D) multiple inheritance Inthe figure above, which of the following BEST describes Z? (A) superclass only (B) subclass only (©) superclass and subelass (D) multiple inheritance Which of the following is TRUE about objects of the same class? (A) Gets a copy of every member function and member variable. (B) _ Gets a copy of every member variable. (©) Gets a copy of every member function. (D) Shares pointers to all member variables and member functions. Which of the following is TRUE about member function definitions? (A) Always require the binary scope operator (::). (B) Require the binary scope operator only when being defined outside of the definition of their class. (© Canuse the binary scope operator anywhere, but become public functions. (D) Must use the binary scope operator in their function prototype. Which of the following is MOST likely a base class of the other three? (A) Employee. (B) Manager. (C)__ Executive. (D) Accountant.18. Which of the following filename extension is a typical header filename extension? (A) oh ®) .hdr (©) -header (D) «cpp Use the statement class x:y 2 {p}; to answer question 19 19. Which letier in the statement above represents the type of inheritance? (A) x @B) y¥ © z @) p 20. Which of the following would NOT be a member function that derived classes Fish, Frog and Bird should inherit from base class Animal and then provide their own definitions for, so that the funetion call can be performed polymorphically? (A) eat (8) sleep (©) move (DP) flapwings [20 marks} SECTION B INSTRUCTION: Answer ALL questions in this section (2) Draw an inheritance hierarchy graph representing a typical university with thousands of people who are classified as Student's. These students consist of UndergraduateStudent and GraduateStudent. UndergraduateStudentss are classified as Freshman, Sophomore, Junior and Senior, AGraduateStudent can be categorized as a Doctoralstudent or aMasterestudent. The university has a special programme that allows some DoctoralStudent and MastersStudent to be Tutors. [6 marks}(6) Show on your graph AN INSTANCE of the following: i, a single inheritance ii, amultiple inheritance iii a superclass only iv. asubelass only Vv, _a.superclass and subclass [5 marks} Use the declaration of the class Triangle and its prototypes, in C++, to answer the following questions. class Triangle { private: int sidel, side2, side3; public: Triangle () ; void setTriangle(int, int, int); void getTriangle(); yi Write PIECES of C+ codes for parts (a) ~ (d) that: (a) define the constructor outside the class. [5 marks} (6) createa Triangle object name trgl. [1 mark] (©) set the sides of the object tral to 10, 12, 15. [2 marks} (@ output the sides of the trg object [1 mark] The program segment below contains FIVE (5) errors. class Q{ public: int Q( ){ qData = pData = 0;} void setpData( int p ){ return pData = p;} void printa(); private: int qData = 0; int pData; } void printg(){ cout << qData << pData << endl;} Identify EACH error and write the correct code for the errors outlined. [10 marks}4, Use the information given below about the TWO classes and the INHERITANCE concept of objects to write C++ codes to define the TWO classes. {NB YOU SHOULD ONLY DEFINE THE CLASS. DO NOT WRITE AN ENTIRE, PROGRAM] class Student { attributes: char * name int id methods: setName (char* n) getName () setId(int idno) getId() } class Freshman { attributes: char * name int id, year methods : setName (char* n) getName () setId(int idno) getid() setYr(int yr) getYr() [20 marks} SECTION C INSTRUCTIO! Answer ONLY ONE question in this section 5. Write a C++ program that creates a class name Employee to represent the employees of an organization. © The class should have five (5) instance variables called fixetName and LastName of type char *, age and yearsOfService of type integer and salary of type floating point for storing the first name, last name, age, years of service and salary of an employee. * It needs TWO methods to get and set each of the data members (the set data method should be called set EmpLoyee and get data should be called print). ‘* It also needs a constructor that initializes an employee object with name “John Brown” age 0, years of service 0 and salary $0.00. © Amain () function, that: = creates an Employee object called e1 with first name “Bob”, last name “Jones”, age 30, years of service 12 and salary $100,000.00 = prints/outputs the values of el. [30 marks]6. Write a C++ program that creates a class name BankAccount to represent the money ina bank account. © Itneeds FOUR methods: fone to deposit a given amount into the account (called deposit that adds the amount received by the method to the balance and stores it in balance) one to withdraw a given amount (called withdraw that subtract the amount received by the method from the balance and stores it in balance) one to check how much money is in the account (called checkBalance that returns the balance). and one to set the amount in a BankAccount. (called setAccount). + Italso needs a constructor that creates an account containing a specified initial amount of money which is set to $0.00. ‘© The class should have one instance variable called balance of type double, for storing the amount of money in the account. * Amain() function, that: creates a BankAccount object called firstAccount; allows the user to set account balance allows the user to make a deposit in the account, allows the user to make a withdrawal from the account checks the balance in the account to determine if there is an overdraft on the account, if there is an overdraft the program should print “Sorry there is an overdraft on your account” otherwise the program should output the balance in the account. (N.B. overdraft means balance is below $0.00) [30 marks} [TOTAL 100 MARKS] END OF EXAMINATIONseer ees rennet ne rn cen wil Meee be 5 THE MICO UNIVERSITY COLLEGE 5 DEPARTMENT OF COMPUTER STUDIES FINAL EXAM PAPER Course Code and Title: (CO0P2101/ COMP2001) OBJECT ORIENTED PROGRAMMING Date: 19" DECEMBER 2016 Time: 1:00 P.M. | Duration 2 HOURS Semester @ Semester! O Summer Session Supplemental Examinations Year: __2016 December a April/May =. juy = Material Required: Answer Booklet: Normal a Special ao Not required o Calculator: (where applicable) Programmable Non-programmable 0 Multiple Choice Answer Sheets: No of items: 1-__20 Numerical o Alphabetical o ‘Auxiliary/Other material: Please specify 1. Students should be given an additional 10 minutes for reading script 2. Allexam scripts must be collected along with answer booklet, 3, Calculators are ALLOWED but must be provided by the institution ‘Students are permitted to bring the following items to their desks: Pens; Pencils; Ruler; Geometry Set; ID Card; Examination Card Instructions to Students: This paper has _° pagesand _?5 questions. ‘Answer ALL questions in section A and section B, and ONE (1) question from section C. Each question should begin on a new page. Students are reminded that the examiners will consider the proper use of the English Language in determining the mark for each response. DO NOT TURN OVER UNTIL INSTRUCTED TO DO SOSECTION A ‘Answer ALL questions in this section. In Object Oriented Programming (OOP), which of the following is classified as data member of a class? a. Behavior b. Attribute cc. Function d. Methods access functions? Which of the following access specifiers is used a. Public b. Private ©. Protected d. Friend in 00? relationships, what is a "is-3” relationship called? h a. Composition b. Inheritance Polymorphism d. Object ‘The format, void r::s(t){u} can be used to define a method. Which letter represents the method's name? ange Objects are created from abstract data types that encapsulate and together. ‘a. Numbers, characters b. Data, functions c. Addresses, pointers d. Integers, floats ‘What OOP concept is utilize in the class definition format class x:y 2(..}? a. Composition b. Inheritance c. Polymorphism d. Modularization7. Given that the user want to use class A’s attributes in class B. Which of the following should be placed on the line below? class At int val; public: Display(cout
You might also like
2024 Summer Model Answer Paper
PDF
0% (1)
2024 Summer Model Answer Paper
28 pages
Oop Imp Questions
PDF
No ratings yet
Oop Imp Questions
19 pages
OOP Final Fall'22
PDF
No ratings yet
OOP Final Fall'22
3 pages
2019 August I-II
PDF
No ratings yet
2019 August I-II
98 pages
Sy Sem III 22316 QP Model Answers Oop
PDF
No ratings yet
Sy Sem III 22316 QP Model Answers Oop
78 pages
Solutions of Csca 2020 by Sourav Gogoi
PDF
No ratings yet
Solutions of Csca 2020 by Sourav Gogoi
11 pages
Case Study 1
PDF
No ratings yet
Case Study 1
5 pages
OOP IMP Questions And Topics
PDF
No ratings yet
OOP IMP Questions And Topics
11 pages
Ai 2002 PDF
PDF
No ratings yet
Ai 2002 PDF
10 pages
Model Answer Paper Summer 2019
PDF
No ratings yet
Model Answer Paper Summer 2019
24 pages
Sample Paper
PDF
No ratings yet
Sample Paper
33 pages
BCA SEM4 OCT 2022 Question Papers
PDF
No ratings yet
BCA SEM4 OCT 2022 Question Papers
11 pages
OOP
PDF
No ratings yet
OOP
3 pages
2015 CE104 1st Internal Paper CE IT
PDF
No ratings yet
2015 CE104 1st Internal Paper CE IT
3 pages
BCA SEM4 APR 2023 Question Papers
PDF
No ratings yet
BCA SEM4 APR 2023 Question Papers
11 pages
d5
PDF
No ratings yet
d5
2 pages
BRIKS
PDF
No ratings yet
BRIKS
4 pages
10 Question Bank
PDF
No ratings yet
10 Question Bank
25 pages
Adp
PDF
No ratings yet
Adp
5 pages
PDF
PDF
No ratings yet
PDF
23 pages
Question 1,2,3,4
PDF
No ratings yet
Question 1,2,3,4
33 pages
Computer Science: 2024 III 09 0930 Seat No. Time: 3 Hours Subject Code H4 7 0 5
PDF
No ratings yet
Computer Science: 2024 III 09 0930 Seat No. Time: 3 Hours Subject Code H4 7 0 5
15 pages
C++ Mcqs - Tutorial Focus
PDF
No ratings yet
C++ Mcqs - Tutorial Focus
69 pages
Eeb315 Final Exam 2016 PDF
PDF
No ratings yet
Eeb315 Final Exam 2016 PDF
6 pages
Computer Science - XII
PDF
No ratings yet
Computer Science - XII
33 pages
High Level Programming MCQ - 240427 - 171534
PDF
No ratings yet
High Level Programming MCQ - 240427 - 171534
15 pages
Oop Assignment 4 170
PDF
No ratings yet
Oop Assignment 4 170
8 pages
Final Oop Paper Spring 2020
PDF
No ratings yet
Final Oop Paper Spring 2020
5 pages
CST 4 Sem Object Oriented Programming 431 S Sep 2021
PDF
No ratings yet
CST 4 Sem Object Oriented Programming 431 S Sep 2021
3 pages
UNIT I Question Bank
PDF
No ratings yet
UNIT I Question Bank
5 pages
Examination Papers, 2002: (All India)
PDF
No ratings yet
Examination Papers, 2002: (All India)
10 pages
OOP 2017july
PDF
No ratings yet
OOP 2017july
4 pages
Ooad 3
PDF
No ratings yet
Ooad 3
4 pages
2016 CE104 University Paper
PDF
No ratings yet
2016 CE104 University Paper
3 pages
2015 CE104 University Paper
PDF
No ratings yet
2015 CE104 University Paper
4 pages
Cimafranca ComProg2 Finals
PDF
No ratings yet
Cimafranca ComProg2 Finals
5 pages
Iipuc-computersciencepreparatoryquestionpaper Dceb3585cee843c99b9f8b93e980d39b 36023
PDF
No ratings yet
Iipuc-computersciencepreparatoryquestionpaper Dceb3585cee843c99b9f8b93e980d39b 36023
3 pages
Ensf 480 Midterm 2018 Solutions
PDF
No ratings yet
Ensf 480 Midterm 2018 Solutions
6 pages
Cs304 Oop Compiled MCQ
PDF
75% (4)
Cs304 Oop Compiled MCQ
140 pages
Object Oriented Programming C MCQs
PDF
No ratings yet
Object Oriented Programming C MCQs
8 pages
II Pu Cs Official[Rs]
PDF
No ratings yet
II Pu Cs Official[Rs]
2 pages
OOP MSBTE Question Paper Summer 2008
PDF
No ratings yet
OOP MSBTE Question Paper Summer 2008
3 pages
C 2
PDF
No ratings yet
C 2
3 pages
Udupi-2nd Pu
PDF
No ratings yet
Udupi-2nd Pu
3 pages
2016 - 1st Internal Paper
PDF
No ratings yet
2016 - 1st Internal Paper
2 pages
Sample Question Paper: Employee Employee Name, Employee ID Getdata, Putdata
PDF
No ratings yet
Sample Question Paper: Employee Employee Name, Employee ID Getdata, Putdata
7 pages
OOP MSBTE Question Paper Winter 2007
PDF
No ratings yet
OOP MSBTE Question Paper Winter 2007
3 pages
Question Paper 2021 Introduction To Object Oriented Programming
PDF
No ratings yet
Question Paper 2021 Introduction To Object Oriented Programming
4 pages
Final Term Examination - February 2005: Time Allowed: 150 Minutes
PDF
No ratings yet
Final Term Examination - February 2005: Time Allowed: 150 Minutes
4 pages
Computer Science 2002 Question Paper
PDF
No ratings yet
Computer Science 2002 Question Paper
5 pages
KIIT University PPL (IT 401) Paper
PDF
No ratings yet
KIIT University PPL (IT 401) Paper
5 pages
CS201 Collection of Old PApers
PDF
100% (2)
CS201 Collection of Old PApers
30 pages
Question Paper - Oop
PDF
No ratings yet
Question Paper - Oop
13 pages
Oops Assignment 1
PDF
No ratings yet
Oops Assignment 1
3 pages