Thanks to visit codestin.com
Credit goes to www.scribd.com

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

CSE1115 Mid 202

This document is a midterm exam for the Object Oriented Programming course at United International University. It consists of multiple questions requiring code corrections, function signature writing, and output predictions. The exam emphasizes adherence to academic integrity and specifies that examinees cannot remove lines of code but may modify or add them.

Uploaded by

Tanvir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

CSE1115 Mid 202

This document is a midterm exam for the Object Oriented Programming course at United International University. It consists of multiple questions requiring code corrections, function signature writing, and output predictions. The exam emphasizes adherence to academic integrity and specifies that examinees cannot remove lines of code but may modify or add them.

Uploaded by

Tanvir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

United International University (UIU)

Dept. of Computer Science & Engineering (CSE)


Midterm Exam :: Trimester: Summer - 2020
Course Code: CSE 1115 Course Title: Object Oriented Programming
Total Marks: 20 Duration: 1 hour
Any examinee found adopting unfair means will be expelled from the trimester / program as per UIU
disciplinary rules

Answer all the questions


Question 1 [Marks: 2 + 3]

A. The following code contains 4 errors. Fix the errors so that the code runs correctly. [2]
Note that: You do not need to rewrite the full code. You can only write the lines where changes should be made. Also
you can not remove any lines from the given code. You can add lines or modify existing lines.

B. Complete the Child class in the following code, so that the code produces the given output. You can not [3]
remove any lines form the code. You also can not add any instance variables to the classes.

Output:
10 20
30

Question 2 [Marks: 1 + 2 + 2]

A. Consider the following function: [1]


void mySuperFunction(String s1, int i2){ ... }
Write a function that has the same signature as the given function. Also write another function that has different
signature.

Page 1 of 3
B. Consider the following code and answer these questions: [2]
i. What is the output of the following code?
ii. Will the code work if we uncomment the line bird.speak("HELLO WORLD!")? Why or why not?

C. Create a student array (named students) in the following code in such a way so that it produces [2]
the given output. You can not remove any lines from the code.

Output:
Bashar 3.78
Khaled 3.66
Rafiq 3.7

Question 3 [Marks: 5]

Carefully consider the following program. [1.5 + 3.5]

i. What is the output of the following code?


ii. Draw the reference diagrams (a diagram which shows the objects and their corresponding references) after
each of the lines with a comment at the end inside main.

Page 2 of 3
Question 4 [Marks: 5]

Fix the error(s) of the following code and then write down the output. [5]

You cannot remove any line of code. You can only add lines/methods to the following code. Write down only the
added lines and the final output in your answer script. You do not need to write the entire code.

Page 3 of 3

You might also like