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

(CSE231) Summer - 2023

This document outlines the exam details for the Advanced Computer Programming course at Ain Shams University, including rules against cheating and prohibited items. It contains three questions covering Java programming concepts, expected outputs of code snippets, and class creation with specific properties. The exam is scheduled for August 31, 2023, and is worth a total of 40 marks.

Uploaded by

omar.ahmed.nes6
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)
98 views3 pages

(CSE231) Summer - 2023

This document outlines the exam details for the Advanced Computer Programming course at Ain Shams University, including rules against cheating and prohibited items. It contains three questions covering Java programming concepts, expected outputs of code snippets, and class creation with specific properties. The exam is scheduled for August 31, 2023, and is worth a total of 40 marks.

Uploaded by

omar.ahmed.nes6
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

AIN SHAMS UNIVERSITY

FACULTY OF ENGINEERING
Computer Engineering and Software Systems Program
Summer, 2022/2023 Course Code: CSE 231, CSE126 Time allowed: 2 Hrs.
Advanced Computer Programming
The Exam Consists of Three Questions in Thee Pages. Maximum Marks: 40 Marks 1/3
Important Rules: ‫ﻌﻠﻴﻤﺎت ﺎﻣﺔ‬
 Having a (mobile -Smart Watch- earphones) inside the ‫ ﺳﻤﺎﻋﺔ اﻷذن( داﺧﻞ‬- ‫ اﻟﺴﺎﻋﺎت اﻟﺬﻛﻴﺔ‬-‫ ﺣﻴﺎزة )ا ﻤﻮل‬
examination hall is forbidden and is considered as a . ‫ﻨﺔ اﻻﻣﺘﺤﺎن ﻌﺘ ﺣﺎﻟﺔ ﻏﺶ ﺴﺘﻮﺟﺐ اﻟﻌﻘﺎب‬
cheating behavior. ‫ ﻻ ﺴﻤﺢ ﺑﺪﺧﻮل أي ﻛﺘﺐ أو ﻣﻼزم أو أوراق داﺧﻞ اﻟ ﻨﺔ‬
 It is forbidden to have any references, notes, books, or .‫وا ﺎﻟﻔﺔ ﻌﺘ ﺣﺎﻟﺔ ﻏﺶ‬
any other materials even if it is not related to the exam
content with you in the examination hall.
Question (1): 15 (MARKS)

Answer the following:


1) How does the BorderPane divide the pane window?

2) Can a Java source file have more than one class?

3) What does “interned strings” mean?

4) Why “@Override” is used before the definition of a function?

5) Which keyword is used to acquire a lock on any object when executing a block of
the code in a method.

6) When “finally” block is executed in try-catch statement?

7) What does the Java compiled file named “Test$3.class” mean ?

8) Can Java allow multiple inheritance?

9) Can the interface have no members? Give an example.

10) How to make a class member shared by all the instances of this class?
AIN SHAMS UNIVERSITY, FACULTY OF ENGINEERING
Computer Engineering and Software Systems Program
Summer, 2022/2023 Course Code: CSE 231, CSE126 Time Allowed: 2 Hrs.
Advanced Computer Programming
The Exam Consists of Three Questions in Three Page 2/3

Question (2): 12 (MARKS)


What is the expected output of the following code?
(a) (b)
public class MyClass { public class MyClass {
public static void main(String args[]) { public static void main(String args[]) {
try{ try {
System.out.print("A"); System.out.print("A");
int num = 99/0; throw new Exception();
System.out.print("B"); }
} catch (Exception e) {
finally { System.out.print("B");
System.out.print("C"); }
} finally {
System.out.print("D"); System.out.print("C");
} int num = 7/0;
} System.out.print("D");
}
System.out.print("E");
}
}
(c) public class Test {
public static void main(String[ ] args) {
new Test();
}
public Test( ) {
PrintChar printA = new PrintChar('a', 4);
PrintChar printB = new PrintChar('b', 4);
printA.run();
printB.run();
}
class PrintChar implements Runnable {
private char charToPrint;
private int times;
public PrintChar(char c, int t) {
charToPrint = c;
times = t;
}
public void run() {
for (int i = 0; i < times; i++)
System.out.print(charToPrint);
}
}
}

2
AIN SHAMS UNIVERSITY, FACULTY OF ENGINEERING
Computer Engineering and Software Systems Program
Summer, 2022/2023 Course Code: CSE 231, CSE126 Time Allowed: 2 Hrs.
Advanced Computer Programming
The Exam Consists of Three Questions in Three Page 3/3

Question (3): 13 (MARKS)

Create three classes: Triangle, Square and Rectangle which have the following
properties:

- You can create one array that has objects of these classes.
- You can sort the objects in this array using “java.util.Arrays.sort” method based
on the area of these objects.
- These classes have a method “printData” that prints the data of their objects.
- An exception is thrown when invalid data is entered.
- An incremental method is used to increment the object data and this method runs
as a thread.
- You can compare between any 2 objects of these classes (based on their areas)
using the method “equals”.

Write a test class that has a main method to show the usage of the above features of
these classes.

END of Exam, Good Luck


Examination Committee: Prof. Mahmoud Khalil Exam. Date : 31 August, 2023

You might also like