0% found this document useful (0 votes)
33 views3 pages

OOP Final Exam

This document contains instructions and questions for a final exam in Object-Oriented Programming. It has 4 questions worth a total of 40 marks. Question 1 (10 marks) contains multiple choice and fill-in-the-blank questions about basic OOP concepts like inheritance, encapsulation, and polymorphism. Question 2 (15 marks) asks students to write C# code for a given class diagram. Question 3 (8 marks) provides a code example with errors and asks students to find and correct the errors. Question 4 (7 marks) asks students to extend the TestShape class from Question 2 by adding methods to add and delete shapes from a list, and using these methods in the main method.

Uploaded by

hamA lol
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)
33 views3 pages

OOP Final Exam

This document contains instructions and questions for a final exam in Object-Oriented Programming. It has 4 questions worth a total of 40 marks. Question 1 (10 marks) contains multiple choice and fill-in-the-blank questions about basic OOP concepts like inheritance, encapsulation, and polymorphism. Question 2 (15 marks) asks students to write C# code for a given class diagram. Question 3 (8 marks) provides a code example with errors and asks students to find and correct the errors. Question 4 (7 marks) asks students to extend the TestShape class from Question 2 by adding methods to add and delete shapes from a list, and using these methods in the main method.

Uploaded by

hamA lol
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/ 3

Philadelphia University Faculty of Information Technology

Lecturer : Ms. Enas Al-Naffar Department of Software Engineering


Coordinator : Dr. Samer Hanna Examination Paper
Internal Examiner: Dr. Ali Fouad

Object-Oriented Programming 721220 Final Exam 2nd semester 2012-2013


Date: 3rd June 2013 Section: 1 Time: 120 Minutes

Information for Candidates


1. This examination paper contains 4 questions. The total is 40.
2. The marks for parts of questions are shown in round brackets.

I. Basic Notions
Objectives: The aim of the question is to evaluate your knowledge and skills concerning
with the basic concepts of OOP.

Question 1: [`10 Marks]


A- Choose the correct answer: [2 Marks, 1 Mark each]

1. When an object has many forms, it has _____.


A) Inheritance
B) Scalability
C) Encapsulation
D) Polymorphism

2. What part of object-oriented technology defines super-class and sub-class relationships?


A) Inheritance
B) Scalability
C) Encapsulation
D) Polymorphism

B- Fill in the blanks with the correct answer: [4 Marks, 1 Mark each]

1. A variable known only within the method in which it is declared is called a(n) ________.
2. Classes from which objects can be instantiated are called __________ classes.
3. It is possible to have several methods with the same name that each operate on different
types or numbers of arguments. This feature is called method __________.
4. Methods in a class that do not provide implementations must be declared using keyword
________.

C- State whether each of the following is true or false. If a statement is false, explain why. [4
Marks, 1 Mark each]

a. Base class constructors are not inherited by derived classes.


b. A has-a relationship is implemented via inheritance.
c. A Car class has is-a relationships with the Steering_Wheel and Brakes classes.
d. When a derived class redefines a base class method by using the same signature and
return type, the derived class method is said to overload that base class method
II. Familiar Problems Solving
Objectives: The aim of the question is to evaluate your basic knowledge of the key aspects
of the lectures material and your ability to solve familiar problems.

Question 2: [15 Marks]

Study the following class diagram, then write its corresponding c# code.

Question 3: [8 Marks]

Study the following class, and then answer the questions below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Animal
{
protected double weight;
protected double height;
protected int x_coordiantion;
protected int y_coordination;

public animal(double h, double w)


{
x_coordiantion=0;
y_coordination=0;
weight=w;
height=h;
}
public abstract void talk()
{
Console.WriteLine("print from the super class");
}
public void walk(double x, double y)
{
x_coordiantion=x;
y_coordianion =y;

}
}

class cat:Animal
{
private string name;

public cat(double h, double w) : base()


{
name="Putchi";
}

public void talk()


{
return stirng.format("{0}", "meaw");
}
public void drink_milk()
{
Console.WriteLine("iam drinking milk");
}
}
class test
{
Animal a = new cat();
cat c = new cat();
c.talk();
c.walk();

a.talk();
a.walk();
a.drink_milk();
}

The three classes above have some errors . find these erorrs and correct them. [8 marks]

III. Unfamiliar Problems Solving


Objectives: The aim of the question is to evaluate your knowledge of the key aspects of the
lectures material and your ability to solve unfamiliar problems.

Question 4: [7 Marks]
Extend the class TestShape in Question 2, by defining a List of type Shape.
- Create a Method within the same class (TestShape) that adds a Shape into the List.
- Create a Method within the same class (TestShape) that deletes a Shape in a given
location ( index)
- Use these newly defend methods in the Main method

Good Luck 

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy