P. 1
Test 1

Test 1

|Views: 7|Likes:
Published by David Kaaya

More info:

Published by: David Kaaya on May 09, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

07/07/2015

pdf

text

original

DAR ES SALAAM INSTITUTE OF TECHNOLOGY DEPARTMENT OF COMPUTER STUDIES CLASS: BENG10 CO TEST 1 OBJECT ORIENTED PROGRAMMING

1. List several advantages of OOP over other programming paradigms 2. Differentiate Private, Protected and Public. 3. What is message-passing as far as OOP is concerned.

4. For a ready made class called Student with attributes: name as String,
age as integer, RegNo as String; write a statement to create an object for this class and assign values to its attributes.

5. Write a short FOR loop statement to count down from 10 to 0. 6. Write a DO-WHILE loop statement which will receive user input and write it back to screen until the value -1 is specified by the user

7. Create two classes: Sphere and Cylinder and specify appropriate
attributes and define methods for area and volume. Create another class (give it a name of your choice) with main function and use it to find volume and area of both sphere and cylinder. 8. What are accessors and mutators? What are the uses and advantages of accessors and mutators

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->