0% found this document useful (0 votes)
61 views

DCS 013 - Object Oriented Programming Examinations

This document provides instructions for an examination on Object Oriented Programming. It states that the exam will take place on December 1st, 2015 from 2-4 PM. It provides general instructions informing students that they cannot write during the reading period and cannot use books or notes during the closed book exam. The exam consists of two sections, with Section A being compulsory and requiring students to answer 1 question and any two others. It provides example questions that assess knowledge of OOP concepts like encapsulation, inheritance, and polymorphism. It also includes questions testing programming skills and understanding of control structures, arrays, and other C++ concepts.

Uploaded by

Raj Gami
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)
61 views

DCS 013 - Object Oriented Programming Examinations

This document provides instructions for an examination on Object Oriented Programming. It states that the exam will take place on December 1st, 2015 from 2-4 PM. It provides general instructions informing students that they cannot write during the reading period and cannot use books or notes during the closed book exam. The exam consists of two sections, with Section A being compulsory and requiring students to answer 1 question and any two others. It provides example questions that assess knowledge of OOP concepts like encapsulation, inheritance, and polymorphism. It also includes questions testing programming skills and understanding of control structures, arrays, and other C++ concepts.

Uploaded by

Raj Gami
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/ 5

UNIVERSITY EXAMINATIONS

EXAMINATION FOR SEPTEMBER/DECEMBER 2015/2016 FOR


DIPLOMA IN COMPUTER SCIENCE / INFORMATION
TECHNOLOGY
DIT/DCS 013 – OBJECT ORIENTED PROGRAMMING
DATE: Tuesday, 1st December, 2015. TIME: 2 HOURS

GENERAL INSTRUCTIONS:
Students are NOT permitted to write on the examination paper during reading time.
This is a closed book examination. Text book/Reference books/notes are not
permitted.

SPECIAL INSTRUCTIONS:
This examination paper consists Questions in Section A followed by section B.
Answer Question 1 and any Other Two questions.
QUESTIONS in ALL Sections should be answered in answer booklet(s).

1. PLEASE start the answer to EACH question on a NEW PAGE.


2. Keep your phone(s) switched off at the front of the
examination room and NOT on your person.
3. Keep ALL bags and caps at the front of the examination room
and DO NOT refer to ANY unauthorized material before or
during the course of the examination.
4. ALWAYS show your working.
5. Marks indicated in parenthesis i.e. ( ) will be awarded for
clear and logical answers.
6. Write your REGISTRATION No. clearly on the answer
booklet(s).
7. For the Questions , write the number of the question on the
answer booklet(s) in the order you answered them.
8. DO NOT use your PHONE as a CALCULATOR .
9. YOU are ONLY ALLOWED to leave the exam room 30minutes to the end of
the Exam.

SECTION A (COMPULSORY)
Page 1 of 5
QUESTION 1 (30 Marks)
A. Define the following terms. ( 4 Marks)
i. Encapsulation
ii. Inheritance
iii. Polymorphism
iv. Constructor
B. Write a program in C++ that asks user to input from 5 to 9 then calculate the average.
(5 Marks)
C. Explain what ARRAY is. (2 Marks)
D. Illustrate what an object is. ( 2 Marks)
E. With examples, give two applications of Object Oriented Programming. (4 Marks)
F. Define an array of 10 doubles and show their index positions. (2 Marks)
G. When do we use “=” and “==” signs in C++? ( 2 Marks)
H. Distinguish between a warning from the compiler and an error message from the
compiler? ( 2 Marks)
I. What is a reference in C++? Give an example. ( 2 Marks)
J. Can you declare a variable, and at the same time assign a value to it? Give an example.
(2 Marks)

K. State three storage qualifiers in C++ ? ( 3 Marks)

SECTION B (Answer ANY Two Questions)

QUESTION 2 (20 Marks)


A. What is overloading? ( 2 Marks)
B. Discuss is public, protected, private access modifiers? ( 3 Marks)
C. Write a program that implements for loop control structure. Sketch the flowchart.
(3 Marks)

D. Can I have multiple main methods in the same class in Java? Reason? ( 2 Marks)
E. What is the purpose of having comments in source files during object-oriented
programming? Using an example show how comments are declared ( 3 Marks)

F. Discuss the C++ code shown below. ( 4 Marks)


#include <iostream>
using namespace std;

int main () {
// local variable declaration:
char grade = 'D';
switch(grade) {
case 'A' : cout << "Excellent!" << endl;
break;
case 'B' : case 'C' : cout << "Well done" << endl;
break;
case 'D' : cout << "You passed" << endl;
break;

Page 2 of 5
case 'F' : cout << "Better try again" << endl;
break;
default : cout << "Invalid grade" << endl;
}
cout << "Your grade is " << grade << endl;
return 0;
}

G. Describe the three basic logical operators with their symbols and how they are
represented in C++ programs. ( 3 Marks)

QUESTION 3 (20 Marks)


A. Explain the following terms. ( 4 Marks)
i. Method Overriding
ii. Abstraction
B. Illustrate what a local class is. ( 2 Marks)
C. Write a programing C++ that implements if…else control structure (3 marks)
D. What is a nested class? ( 2 Marks)
E. What is the difference between while and do while control structure in Java?
(2 Marks)
F. Discuss the output the C++ code shown below upon execution. ( 3 Marks)
#include <iostream>
using namespace std;

int main ()
{
char campus[6] = {'R', 'I', 'A', 'R', 'A', '\0'};
cout << "Best University is: ";
cout << campus << endl;
return 0;
}

G. Illustrate how loops can be controlled in the following ways. ( 4 Marks)


i. Counter-controlled repetition.
ii. Sentinel-controlled repetition.

QUESTION 4 (20 Marks)


A. What happens when a function throws an exception that was not specified by an
exception specification for this function? ( 2 Marks)

B. Explain two advantage of Object Oriented Programming. ( 4 Marks)

C. Explain the following terms ( 4 Marks)


i. Source Code
ii. Machine Code
iii. Linking
iv. Compiling
Page 3 of 5
D. Write a program that implements while control structure. ( 3 Marks)
E. Does garbage collection guarantee that a program will not run out of memory in Java?
(2 Marks)
F. Discuss the flow chart shown below and state the control structure it is representing.
(3 Marks)

G. Differentiate between declaration and initialisation of variables. ( 2 Marks)

QUESTION 5 (20 Marks)


A. Explain one advantage of inheritance. ( 2 Marks)
B. Explain the difference between the following errors. ( 3 Marks)
i. Logical Errors
ii. Runtime Errors
iii. Syntax Errors
C. Expound on the following types of blocks used in exception handling in. ( 3 Marks)
i. Try block
ii. Throw block
iii. Catch block
D. What is unique about a final method and a final class in Java? ( 2 Marks)
E. What does it mean that a method or field is "static"? ( 2 Marks)
F. Illustrate a super class and a subclass. ( 2 Marks)
G. Do I need to import java.lang package any time? Why? ( 2 Marks)
H. Discuss the flow chart shown below and state the control structure it is representing.
(3 Marks)

Page 4 of 5
I. Why do we include break statement in the switch case programs? ( 1 Mark)

Page 5 of 5

You might also like