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

Mid Exam For Java

This document is a mid-exam paper for a B.Sc. in Computer Science course on Object Oriented Programming at Adama Science & Technology University. It consists of multiple parts including Java code output questions, short notes on Java concepts, multiple-choice questions, and programming tasks. The exam is structured to assess students' understanding of Java programming and object-oriented principles.

Uploaded by

robelabirew
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)
4 views3 pages

Mid Exam For Java

This document is a mid-exam paper for a B.Sc. in Computer Science course on Object Oriented Programming at Adama Science & Technology University. It consists of multiple parts including Java code output questions, short notes on Java concepts, multiple-choice questions, and programming tasks. The exam is structured to assess students' understanding of Java programming and object-oriented principles.

Uploaded by

robelabirew
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

Adama Science & Technology University

School of Electrical Engineering and Computing Engineering


Department of Computer Sciences
[Link]. in Computer Science
Object Oriented Programming
(MID EXAM)
[Link]. (AM) II Year II Semester Points : 30

Instructor: Dr. Rajesh Sharma R/Kidane/Endale Duration : 2.00 Hrs.

Course Code / Name: (CSE1102/ OBJECT ORIENTED PROGRAMMING)

Name of the Student: (Note your name in ALL CAPITAL letters)

ID/ NUMBER:

Part-I: /(5) Part-II: /(5) Part-III: /(15) Total points: / (30)


Date: 27-04-2018

Part-I write the output of the following JAVA code. 5x1=5


1).public class Operators {

public static void main(String[] args) {


[Link](-5 + 8 * 6);
[Link]((55+9) % 9);
[Link](20 + -3*5 / 8);
[Link](5 + 15 / 3 * 2 - 8 % 3);
}
}
2) class Usestatic {
private static int x;
public static void main(String args[]){
[Link](fun()); }
static int fun() {
return ++x;
}}

3) public class Usescanner{


public static void main(String[] args) {
int i,j,n; [Link]("Input number of n : ");
Scanner in = new Scanner([Link]);
n = [Link]();
for(i=1;i<=n;i++)
{ for(j=1;j<=i;j++)
[Link](i); [Link]("");
} } }
4) class Useloop {
public static void main(String[] args) {
for(int i = 0; true; i++) {
[Link]("Hello");
break;
}
}
}

5) class Useobject {
protected int x, y;
}
class Object {
public static void main(String args[]) {
Useobject t = new Useobject ();
[Link](t.x + " " + t.y);
}
}

Part-II write the short notes of following question. 5 x 2 = 10


1. What is an object in java?

2. Differentiate overloading and overriding in java.

3. Define Abstract Class in java.

4. What is access specifier in java?

5. State four important java keywords.

Part-III write the short notes of following question. 5x1=5

[Link] of these packages contain all the collection classes?

a) [Link]
b) [Link]
c) [Link]
d) [Link]
2. Which of these keywords is used to make a class?
a) class
b) struct
c) int
d) none of the mentioned

3. Which of the following is a valid declaration of an object of class Box?


a) Box obj = new Box();
b) Box obj = new Box;
c) obj = new Box();

4. Which of these statement is incorrect?


a) Every class must contain a main() method
b) Applets do not require a main() method at all
c) There can be only one main() method in a program
d) main() method must be made public

5. What is the return type of a method that does not returns any value?
a) int
b) float
c) void
d) double

Part-IV Write any TWO java programs for the following 2 x 5 = 10

1. Write a java program for animal’s parent class behaviour using multiple inheritance.
2. Write a java program for to preparing student mark list for three different students using
constructor.
3. Write a java program that accept ten integer numbers from keyboard and stored in the
array and display the sum of prime number from the array.

*******All the best*******

You might also like