Dr.
Babasaheb Ambedkar Open University, Ahmedabad
Question Bank:
Object Oriented Concepts & Programming - I (Core JAVA)
BCA
A. Answer the following: (long answer question)
1. What is the need of programming? Describe the concept of programming?
2. What do you understand by the Java Virtual machine and byte code?
3. Describe the java class library?
4. Describe the variable and assignments are used in Java?
5. How to use string and constant in Java?
6. Write a note on various types of loops with its relevant examples.
7. Describe the various types of operators used in Java programming?
8. Describe if statement and their types? With example
9. What do you understand by the looping statement? Describe in detail
10. Describe switch statement and bitwise operator?
11. Write a program to display triangle of * using nested for loop?
12. Write a program to print tables of 2?
13. Describe the concept of class? How to create a simple class?
14. Describe the concept of constructor? How to create constructor in class?
15. Describe static variables and methods?
16. Describe the concept of inheritance in Java? Explain the types of inheritance?
17. Describe exception handling in Java?
18. Explain in detail about GUI in Java?
19. Compare among Character oriented stream and Byte oriented stream?
20. What is meant by Stream and what are the types of Streams and classes of the
Streams?
21. Describe the file classes in Java? Explain file handling?
22. Write a program to create a package in Java?
23. Write a program that throws an exception.
24. Explain user defined exception? Explain with suitable example?
25. Write a program using throw keyword
26. Write down the procedure for event handling.
27. Explain how to reading and writing files in java?
28. How is console output accomplished?
29. Write a program to read characters from console.
30. Write a multithreaded program to create threads and use suspend and resume methods
to transfer control.
B. Answer the following: (short answer question)
1. What do you mean by programming?
2. What do you mean by Java platform?
3. Explain the multi-threaded and dynamic feature of Java.
4. Write a note on portability and security feature of Java.
5. Compare Java with C++ with respect to garbage collection and inheritance.
6. Give the difference between Java and C++ with respect to strings and operator
overloading.
7. What is the occurrence of garbage collection?
8. Explain JDK?
9. What do you mean by Java binary code?
10. What are Java Expressions?
11. Explain type expression?
12. Write short note on Java classes?
13. What is the syntax of While...do loop?
14. What is the use of this class in Java?
15. Explain nested loops.
16. Explain else___if statement?
17. What is the idea of break statement?
18. What is FOR loop?
19. Explain increment and decrement operator?
20. Explain relational and logical operator?
21. What will be highest value among three integers as per ternary operations?
22. Explain the constructor overloading?
23. What is the scope of local variables?
24. Describe the concept of method overloading?
25. What do you understand by the wrapper classes?
26. What is the difference between multiple and multilevel inheritance?
27. Explain class modifiers?
28. It is possible to use the File class to list the contents of the current working directory.
29. What is the purpose of the File class?
30. Explain [Link] package with examples?
31. Explain collection framework?
32. Write a program to create a class constructor?
33. How to create layout in GUI?
34. Write a program for an uncaught exception handler.
35. Write a note on instance variables?
36. Write the advantages of GUI?
37. Explain the execution of multiple catch statements.
38. Write the syntax of finally keyword.
39. What is a frame?
40. Why graphics is considered an abstract class?
41. Give the use of canvas and container objects.
42. Explain the text area component of the AWT package.
43. Give the general rules for using Layout Manager.
44. Explain Card Layout.
45. What are adapter classes?
46. What could be declared a local or anonymous class?
47. Write a note on the other applet methods.
48. Write a note on init () method.
49. When is the destroy () method called?
50. Write a program to illustrate the use of byte streams.
C. Multiple choice question:
1) Choose the correct answer:
1. Programming language involves:
a. computer c. software
b. codes. d. all
2. The comment in an Algorithm begins with_______.
a. /* c. */
b. / d. //
3. In programming language, the basic language is:
a. machine language c. both a and b
b. low level language d. none of the above
4. The object oriented technology includes:
a. object oriented management of projects
b. computer hardware
c. computer aided software engineering
d. all of above
5. Programming skills can be checked:
a. by writing a programme c. by working on software
b. by testing a program d. all of these
6. What will be output of the program?
int x = 1, y = 6
while (y--)
{
x++;
}
[Link](“x=”+x”y=”+y)
a. x = 1 y = 0
b. x = -7 y = 6
c. x = 3 y = -4
d. compilation error
7. OAK was renamed as Java in year:
a. 1995 c. 1997
b. 1996 d. 1994
8. Which is not associated with first Java program?
a. class c. static
b. public d. syntax
9. To work on Java, you have to have:
a. computer c. tool kit
b. webcamera d. development kit
10. Find the result obtained after executing this program.
int disp()
{
int x,y=10,z=10;
x=(y==z);
[Link](x);
return 0;
}
a. 0 c. -1
b. 1 d. 2
11. What will be the output of the following program?
int i;
float f;
i = 10;
f = 10.5f;
f = f - i;
a. 0.5 c. 1.5
b. 1 d. 10
12. Which is not a data type?
a. bits c. short
b. byte d. int
13. Which among the following acts as a selective statement?
a. if c. for
b. goto d. else if
14. What will be value obtained, if the program is executed?
Public class ControlStatement {
Public static void main (string [] args){
int a = 25;
if (~a>25)
a++;
a+=a;
[Link] (a);
}
}
a. -49 c. 48
b. 50 d. 65
15. In switch statement, an expression evaluates to:
a. int c. byte
b. short d. all
16. Which among the following is not a bitwise operator?
a. & c. |=
b. &= d. <=
17. In the example, the Stock is called as:
Class Stock {
Public commodity;
Public price;
Public void buy (int no_of commodity) {}
Public boolean sale () {}
}
a. Class c. Methods
b. Fields d. None of above
18. While creating a simple class program, you have to consider:
a. Class creating c. Instance variable accessing
b. Object creation d. all of above
19. Identify the return type of Constructor from the following.
a. int
b. float
c. void
d. None of above
20. Which among the following can be overloaded?
a. Methods c. Constructors
b. Class d. Fields
21. What will be the correct option, when "these keywords" are displayed?
Class Rectangle {
int length;
int breadth;
void setDiamentions (int ln, int br)
{
[Link] = ln;
[Link] = br;
}
}
Class RectangleDemo {
Public static void main(String args[]) {
Rectangle r1 = new Rectangle();
[Link](20,10);
[Link](“Length of Rectangle :” +[Link]);
[Link](“Breadth of Rectangle : ”+[Link]);
}
}
a. Length of Rectangle: 20 c. Both a and b
b. Breadth of Rectangle: 10 d. Neither a nor b
22. Which is correct about local variables?
a. It is declared inside a method
b. It exist at the time of its execution
c. It carries no relationship among each other
d. All of these
23. Arguments is a list of:
a. Parameters c. Array
b. Programs d. None of above
24. Which is correct in case of garbage collector?
a. It describes about heap memory
b. It describes about the status of object
c. It deletes unused objects
d. All of these
25. Select the correct option if class A is inherited by class B.
a. class B + class A
b. class B inherits class A
c. class B extends A
d. class B extends class A
26. Identify the three software parts of GUI program?
a. Windows, Buttons, Mice
b. GUI Components, Graphics, Code
c. GUI Components, Event Listeners, Application Code
d. Frames, Code, Events
27. Which among the following component exists in all GUI programs?
a. Frame c. Monitor
b. Mouse d. Button
28. A Graphics object is:
a. object showing part of Frame which can be drawn.
b. object that shows whole Frame.
c. object that shows full monitor.
d. object that shows graphics board.
29. In order to design a graphical user interface, it require
a. Creating a new form of dialogue
b. Placing and arranging components in the form
c. Defining properties of the components
d. All of the above
30. Which among the following method will be helpful to read from file?
a. get() c. scan()
b. read() d. readFileInput()
2) True or False:
1. Abstraction involves solving of certain program by breaking up into simpler
levels.
a. True
b. False
2. Bytecode is a computer object code which is obtained by a program machine
called as virtual machine instead of actual computer machine as the processor.
a. True
b. False
3. Desktop based applications were developed with the help of J2SE that carries
necessary user interface classes.
a. True
b. False
4. JDK also known as Java Dependent Kit
a. True
b. False
5. Applet viewer runs and debugs Java applets without Web browser.
a. True
b. false
6. Branching is not a part of control structure?
a. True
b. False
7. Innermost loop executing a program having nested loops, which loop will be
executed maximum number of times.
a. True
b. False
8. In Java, the while loop is applied till condition remains:
a. True
b. False
9. In Java, do...while loop will execute every time.
a. True
b. False
10. In Nested loop, the inner loop is while loop:
a. True
b. False
11. In programming, looping is common which will make us to reach on certain
results.
a. True
b. False
12. In Java lots of skills are used to study about Java classes which gets created using
keyword
a. True
b. False
13. Block is a group of consecutive statements having similar indentation.
a. True
b. False
14. Boolean expression is an expression which shows the result as true or false.
a. True
b. False
15. In Java operators are categorized as unary, binary, ternary or fourthary.
a. True
b. False
16. In Java, final variable is constant as you cannot alter its value once you create and
initialize it.
a. True
b. False
17. Static is a type of class variable which is not an object variable
a. True
b. false
18. A java package is a group of similar types of classes, interfaces and sub-packages.
a. True
b. False
19. The Error subclasses shows serious errors which a program shouldn't expect to
catch and recover from.
a. True
b. False
20. Runtime exceptions are exceptions which are thrown at runtime.
a. True
b. False
21. An applet is a small program that is intended to be embedded inside another
application such as a browser.
a. True
b. False
22. A Frame is a Window with all the window manager’s adornments (window title,
borders, window minimize/maximize/close functionality) added.
a. True
b. false
23. Inner classes may inherit static members that are not compile-time constants even
though they may not declare them.
a. True
b. False
24. A stream can represent disk files, devices, other programs and memory arrays and
also as many different kinds of sources and destinations target.
a. True
b. False
25. Byte streams are used by programs for the purpose of performing input and output
of 8-bit bytes.
a. True
b. false
Answer
1) Choose the correct answer
1. d 16. d
2. d 17. a
3. c 18. d
4. d 19. d
5. d 20. c
6. d 21. c
7. d 22. d
8. d 23. a
9. d 24. d
10. b 25. c
11. a 26. c
12. b 27. a
13. a 28. a
14. d 29. d
15. d
30. b
2) True or False:
1. a
2. a
3. a
4. b
5. a
6. b
7. a
8. a
9. b
10. a
11. a
12. a
13. a
14. a
15. b
16. a
17. a
18. a
19. a
20. a
21. a
22. a
23. a
24. a
25. a