lOMoARcPSD|19982089
Java-BIS-Midterm B - Midterm exam
Programming 2 ()سيوسلا ةانق ةعماج
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Nathanael Sanchez (
[email protected])
lOMoARcPSD|19982089
Suez Canal University Semester: Second, 2022/2023
Faculty of Commerce Course Name: Programming II
English Section BIS – Group B Time Allowed: 40 minutes
Dr. Ehab ElSalamouny Midterm Exam, Marks: 20, Pages: 1
1. A java source file has the extension (a) .class (b) .js (c) .java (d) .txt
2. To produce file Movie.class we write (a)jcc Movie.java (b)compile Movie.java (c)java Movie.java (d)javac Movie.java
3. Which component in the computer transforms Java byte code into machine language
(a) operating system (b) compiler (c) JVM (d) editor
4. A Java program that runs on the server is a/an (a) servlet (b) applet (c) application (d) class
5. The Java syntax is ____ to the C++ syntax (a) identical (b) completely different (c) similar (d) none of mentioned
6. Which one of these statements is correct? (a) int x = 2.3; (b) double x=2.3 (c) double x; (d) both (b) and (c)
7. The code {int age=10; Age++;} gives (a) age=10 (b) age = 11 (c) compile error (d) run-time error
8. The code {double x = 10.5; int z = x + 1 ;} gives (a) z = 10.5 (b) z = 11 (c) z=11.5 (d) error
9. The code {int x=3, y=10; double z = y%x;} gives (a) error (b) 3.333 (c) 3.0 (d) 1.0
10. The code {double x = 10.5; int z = (int) x + 1 ;} gives (a) z = 10.5 (b) z = 11 (c) z=11.5 (d) error
11. The code {int x=3, y=10; double z = y/x;} gives (a) error (b) 3.333 (c) 3.0 (d) 1.0
12. The code {int x, y=10; double z = x+ z;} gives (a) error (b) 3.333 (c) 3.0 (d) 1.0
13. Which statement is used to exit from a function (a) return (b) exit (c) break (d) continue
14. Which statement is used in a loop to start the next iteration (a) return (b) exit (c) break (d) continue
15. The function public String func(int x, double y) {…} returns ___ value (a) int (b) double (c) String (d) none
[16] (a) int (b) double (c) Boolean (d) void public [16] getSum ( int start , int end ) {
[17] (a) double (b) int (c) Boolean (d) none [17] sum = 0;
[18] (a) sum>start (b) sum<end (c) k<=end (d) k>start int k=start;
[19] (a) sum =k; (b) {sum=sum+k; k++;} (c) sum=sum+k; (d) k++; while ([18])
[20] (a) return k; (b) return start+end; (c) return sum; (d) none [19]
[20]
}
Fill the following sheet with your answers
Name