BTC 2101 - OBJECT ORIENTED PROGRAMMING I- JULY 2016_2.pdf

BTC 2101 - OBJECT ORIENTED PROGRAMMING I- JULY 2016_2.pdf -...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
FACULTY OF INFORMATION TECHNOLOGY BACHELOR OF SCIENCE IN TELECOMMUNICATION BTC 2101: OBJECT ORIENTED PROGRAMMING I Date: 07 July 2016 END OF SEMESTER EXAM Time: 2 Hours Instructions 1. Answer all questions in the answer booklet provided. 2. Answer Question ONE (COMPULSORY) and any other TWO questions. 1. (a) (i) What is the difference between an Object Oriented Programming Language and an Imperative Programming Language? (3 marks) (ii) What is a class ? What is an object ? (2 marks) (iii) What are primitive datatypes? (give three (3) examples) (3 marks) (iv) What is overloading? (2 marks) (b) Express the following OOP concepts using Java code in a few lines (not more than 10 lines of code): (i) Inheritance (5 marks) (ii) Encapsulation (5 marks) (c) (i) Complete the code below to display the title ’My Nice Frame.’ . (4 marks) 1 import java.awt.* ; 2 import java.awt.event.* ; 3 class MyFrame extends XXX implements YYY { 4 MyFrame ( String title ){ 5 6 setBackground ( SystemColor . control ); 7 addWindowListener ( this ); 8 pack (); 9 setVisible ( true ); 10 } 11 public void windowOpened ( WindowEvent e ){} 12 //!NOTE: Invoked when the user attempts to close the 13 // window from the window’s system menu. 14 public void windowClosing ( WindowEvent e ){ Question 1 continues on the next page. . .
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
BTC 2101 Exam OBJECT ORIENTED PROGRAMMING I Page 2 of 5 15 dispose (); 16 System . exit (0); 17 } 18 public void windowClosed ( WindowEvent e ){} 19 public void windowIconified ( WindowEvent e ){} 20 public void windowDeiconified (
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern