Professional Documents
Culture Documents
-4) (CBCS) PRILIM EXAM JAVA PROGRAMMING Date:-31/03/2012 Section -I The following code will allow the program to obtain a name from the keyboard String name = Console.readLine("Enter name); Marks:-70
1)
(A) True 2)
The name of a variable is known as its:
(B) False (B) constant (D) base (B) 2.5 (D) None of these (B) false (B) getSelectedItem() (D) none of these
The following statement is valid double price = 7,450.98; To get the item from a choice by its index,_____ method is used.
Consider the following code snippet String river = new String(Columbia); System.out.println(river.length());
(A) 6 (C) 8 7)
The full form of AWT is _____
What is the result of the expression (1 & 2) + (3 | 4) in base ten. (A) 1 (C) 8 (B) 2 (D) 7
9)
Which of the following lines will not compile? 1. byte b1 = 5, b2 = 3, b3; 2. short s = 25; 3. b2 = s; 4. b3 = b1 * b2; (A) Line 1 only (B) Line 3 only (C) Line 4 only (D) Line 3 and Line 4 only
10) Consider the following class defi nition: class A extends B { public A (int x) { } public A (int x, int y) { super (x, y) ; } } Which of the following are legal statements to construct A type objects?
int sum(int x, int y) { } 11) Which of the following are overloading the method (A) int sum(int x, int y, int z) { } (B) fl oat sum(int x, int y) { } (C) fl oat sum(int x, int y,int z) { } 12) A package is a collection of (A) classes (C) editing tools (D) none of these (B) interfaces (D) classes and interfaces
13) Which of the following are the wrapper classes? (A) Random (B) Byte (C) Vector (D) integer 14) Which of the following methods can be used to draw the outline of a square? (A) fillRect() (B) drawRect() (C) drawLine( ) (D) drawString( )
15) Which of the following methods can be used to change the size of a component (A) dimension() (B) setSize() (C) size() (D) none of these. 16) Which are the valid ways to create DataInputStream streams? (A) new DataInputStream( ); (B) new DataInputStream(in.dat, r); (C) new DataInputStream(new (D) new DataInputStream(in.dat)
FileInputStream(in.dat); 17) Given file is a File object, which of the following are legal statements to create a new file
FileInputStream(fi le); 18) Which exception is thrown by the read( ) method of InputStream class?
19) When we implement the Runnable interface, we must defi ne the method? (A) start( ) (B) . init( ) (C) run( ) (D) runnable()
20) The setBackground( ) method is part of the class (A) Graphics (B) Applet (C) Object (D) Component
Section-II Q 1 A Answer the following (Any 3) 1) What is the difference between a Scrollbar and a ScrollPane? 2) What is a Java package and how is it used? 3) What are synchronized methods and synchronized statements? 4) What method must be implemented by all threads? 5) Name the containers which uses Border Layout as their default layout? 06
6) What is similarities/difference between an Abstract class and Interface? Q1B Answer the following (Any 3) 1) What are Access Specifiers available in Java? 2) What is final modifier? 3) What are static methods? 4) Describe synchronization in respect to multithreading. 5) What is the difference between error and an exception? Answer the following (Any 2) 09
Q1C
10
1) Explain Thread Life Cycle in detail With Example. 2) List any five methods of graphics class and explain any three of them. 3) What is an event? Explain mounse related events. Q2 A 1) 2) 3) 4) Q1 B 1) 2) 3) Answer the following (Any 3) Difference between Applet and swing. What is layout manager. What is deadlock and syncronization. Write a methods of List Box. 06
Answer the following (Any 2) 10 Write a command line program to read binary file and copy that file on given location. Write a note on CharacterStreams and differentiate Character Streams and ByteStreams. Write a program to display your name in the center of the applet.