OOP Final Exam
OOP Final Exam
I. Basic Notions
Objectives: The aim of the question is to evaluate your knowledge and skills concerning
with the basic concepts of OOP.
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]
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;
}
}
class cat:Animal
{
private string name;
a.talk();
a.walk();
a.drink_milk();
}
The three classes above have some errors . find these erorrs and correct them. [8 marks]
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