A10.2-R3: Introduction to Object Oriented Programming Through Java
: JULY 2005
NOTE:
1. There are TWO PARTS in this Module/paper. PART ONE contains FOUR questions and PART TWO contains FOUR questions.
2. PART ONE is to be answered in the TEAR-OFFANSWER SHEET only, attached to the question paper, as per the instructions contained therein. PART ONE is NOT to be answered in the answer book.
3. Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO will be supplied at the table when the answer sheet for PART ONE is returned. However, candidates who complete PART ONE earlier than one hour, can collect the answer book for PART TWO immediately after handing over the answer sheet for PART ONE.
TOTAL TIME: 3 HOURS TOTAL MARKS: 100
(PART ONE-40; PART TWO – 60)
PART ONE
(Answer all the questions)
1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1 x 10)
1. Which of the following is java keyword?
A) External
B) Implement
C) throw
D) Integer
2. What gets printed when the following program is compiled and run
class test{
public static void main(String args[])
int i;
do {
i++;
}while(i<0);
System.out.println(i);
}
}
A) The program does not compile, as i is not initialized.
B) The program compiles but does not run.
C) The program compiles and runs but does not print anything
D) The program prints 0.
3. The last statement in a finalize method should always be
A) super(finalize)
B) super.finalize()
C) finalize(methodname)
D) None of the above
4. What gets printed when the following program is compiled and run?
Public class incr{
public static void main (String args[])
int i, j;
i=j=3;
int n=2 *++i;
int m2 *j++;
System.out.println(i+ “ “ +j + “ “+n+ “ “+m);
}
}
A) 4 4 8 6
B) 4 4 8 8
C) 4 4 6 6
D) 4 3 8 6
5. What is byte code in the context of java?
A) The type of code generated by a Java compiler
B) The type of code generated by a Java Virtual Machine
C) It is another name for a Java source file
D) It is the code written within the instance methods of a class
6. Which of the following keyword should be used to make a variable defined in the class accessible only to methods defined in the classes in same package.
A) By using the keyword package before the variable
B) By using the keyword private before the variable.
C) By using the keyword protected before the variable.
D) The variable should not be preceded by any of the above mentioned keywords.
7. Select the one most appropriate answer. What id the purpose of method parseInt defined in Integer class?
A) The method converts an integer to a String.
B) The method is used to convert String to an integer, assuming that the String represents an integer.
C) The method is used to convert String to Integer class, assuming that the String represents an integer.
D) The method converts the Integer object to a String.
8. What is the default priority of a newly created thread?
A) MIN_PRIORITY (which is defined as I in the Thread class)
B) NORM_PRIORITY(which is defined as 5 in the Thread class)
C) MAX_PRIORITY(which is defined as 10 in the Thread class)
D) A thread inherits the priority of its parent thread.
9. Which one does not have a valueOf(String) method.
A) Integer
B) Boolean
C) Long
D) Short
10. Which of the following method is used to initialize the instance variable of a class.
A) Class
B) Public
C) Constructor
D) Destructor
2. PART ONE is to be answered in the TEAR-OFF ANSWER SHEET only, attached to the question paper, as per the instructions contained therein. PART ONE is NOT to be answered in the answer book.
1. By using a thread class multithreaded program can be created.
2. It is possible for two threads to access the same variable or the same method of same object at same time.
3. A class that inherits from another class is called a super class and inherited class called subclass.
4. The size () method determines the number of elements in Vector.
5. Classes, which are declared as final, can have at least one subclass derived from it.
6. By default classes inherit from the object class, which is a super class of all classes in the java class hierarchy.
7. Initialization can happen only ones in the applets lifetime.
8. The label’s font can be changed using the setFont() method.
9. A component can have multiple listeners for an event type.
10. Key events are generated when a user presses or releases a key on the keyboard.
3. Match words and phrases in column X with the closest related meaning/word(s)/phrase(s) in column Y. Enter your selection in the "tear-off' answer sheet attached to the question paper, following instructions therein.(1 x 10)
1. To compare two strings to each other
A. wrapper class
2. The block will execute even whether or not an Exception is thrown is done through
B. Static method
3. It is used for garbage collection
C. .equals()
4. addElement()is the method of
D. do while loop
5. The loop that will always be executed once
E. main()
6. To ensure that resource will be executed by only one Thread at a time.
F. finally
7. It is invoked even before a single instance of a Class is created
G. finalize()
8. Java applets doesn’t have
H. Vector class
9. Integer class is a member of
I. Synchronized
10. is used to instantiate the Object
J. Constructor
K. Destructor
L. join()
4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the "tear-off' answer sheet attached to the question paper, following instructions therein. (1 x 10)
A. Applets
B .Start()
C. J RadioButtons
D. Inheritance
E. Implements
F. throws
G. String
H. Class
I. Bytocode
J. Join()
K. ActionListener
L. Constructor
1. Java ___________ are java programs, which are specifically made to run in enabled web browser.
2. The byte code file created by the Java compiler has a(n) ________ extension
3. The methods used to instantiate the object from a class are called __________
4. _________ is a mechanism that enables one class to inherit all the behavior and attributes of another class.
5. A class can use an interface by using the _________ clause
6. RadioButtons are implemented in swing through the __________ class
7. A special clause called ___________ is used in method definition to indicate that a method may possible throw an exception.
8. The ________ control method is used to temporarily stop the execution of the thread.
9. The _______ method suspends the current thread until that thread object dies.
10. After the ____________ method is called, the thread is in a Runnable state. For more questions papers visit www.DoeaccOnline.com, www.IgnouOnline.com
PART TWO
(Answer any FOUR questions)
5. a) What is the difference between Abstract class and as Interface
b) Explain, “write once run anywhere” nature of Java.
c) What does the “final” keyword mean in front of a variable, a method and a class?
d) What does the “static” keyword mean in front of a variable, a method and a class?
e) What is JDBC? What are its drivers ? Explain in brief.(5 X 3)
6.Write a program using swing and awt to design a digital clock.(15)
7.a) Explain the Dynamic method dispatch with the help of coding.
b) Distinguish between packages and interfaces with examples.(8+7)
8.a) What do you understand by Inter thread Communication? Explain it.
b) Write a program to print factorial numbers.(5+10)
9.Write short notes on :-
a) Proxy Servers
b) Exception Handling
c) Access specifiers public, private, protected
d) Applet architecture
e) Constructors(5 X 3)