CS504A - Object Oriented Programming Using Java - MidTermQuestions - For Stud
CS504A - Object Oriented Programming Using Java - MidTermQuestions - For Stud
No:
Roll Number
MID-SEMESTER EXAMINATION, 2020-21
Fifth Semester
Part - A
Attempt all (5) Questions from the following 05*2=10 Marks
Q. Question Mark
No s
1. Which of the following declarations does not compile? Class (2)
(a) double num1, int num2 = 0;
(b) int num1, num2;
(c) int num1, num2 = 0;
(d) int num1 = 0, num2 = 0;
2. Which statement about a valid .java file is true? (2)
(a) It may define at most one public class.
(b) It can only contain one class declaration.
(c) It can contain one pulic class declaration and one public interface
definition.
(d) It must define at least one public class.
3. Which is correct about an instance variable of type String? (2)
a) It defaults to null.
b) It defaults to an empty string.
c) It does not have a default value.
d) It will not compile without initializing on the declaration line
4. (2)
What is true of the finalize() method?
5. (2)
How do you force garbage collection to occur at a certain point?
Part - B
Attempt any Two (2) Questions from the following 2*5=10 Marks
Q. Question Marks
No
6. a) (2+2
Write java program(s) to explain the concept of =4)
aggregation and composition?
b) (1)
7. a) (2)
Write a java program to explain the concept of inner
class?
b) (1)
What are the different types of inner class in java?
Part - C
Attempt the Question from the following 1*10=10 Marks
Analytical/Numerical based/Case Study/Application oriented/Higher order Thinking Level of
Questions Only
Q. Question Marks
No
9. a) (2+3+2+
What is difference between Heap and Stack 3 = 10)
Memory in java? Write a java program to show the
difference between the Inner Class and Sub Class?
What is static loading and dynamic class loading?
Write a java program to show static
polymorphism?
class TestA {
System.out.println("Welcome");
break;