Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

QUESTION BANK

OBJECT ORIENTED PROGRAMMING USING JAVA


(TCS-304)
DATED: 23rd November,2012
Section A: Objective

(1) An association is the _______________ among classes.


a. Relationship
b. Link
c. Connection
d. All of the above
(2) Multiplicity denotes the ____________ of the association
a. aggregation
b. cardinality
c. link
d. All of the above
(3) How many inheritances are there in Java
a. 5
b. 4
c. 3
d. 0
(4) Aggregation and Generalization
a. both are same concept
b. both are different concept
c. cannot be predicted
d. None of the above
(5) What do you mean by “Roles names”?
a. both end of an association
b. one end of an association
c. cannot be predicted
d. None of the above
(6) The information gathered for object model from
a. Problem statements
b. User interviews
c. Expert knowledge of application domain
d. All of the above
(7) Data hiding means
a. Encapsulation
b. Abstraction
c. Polymorphism
d. Inheritance
(8) Who developed java?
a. James Gosling
b. Bjarney Stroutrop
c. Dennis Ritchie
d. Herbert Scheldt
(9) How many types of constructor Java has

1
a. 5
b. 4
c. 3
d. 1
(10) Full form of DFD is
a. Data Flow Diagram
b. Data Flow Definition
c. Diagram Flow of Data
d. None Of These
(11) A remote control that is used to turn on or off some machine is also called a(n) _____.
a. class
b. interface
c. message
d. instance
(12) In a student grading system, Student Last Name, Student Address, and Final Course Grade would
all be classified as what?
a. Inheritance
b. Information
c. Encapsulation
d. Polymorphism
(13) What part of object-oriented technology defines superclass and subclass relationships?
a. Inheritance
b. Scalability
c. Encapsulation
d. Polymorphism
(14) In a student grading system, objects from different classes communicate with each other. These
communications are known as _____.
a. inheritance
b. polymorphism
c. messages
d. concealment
(15) When an object has many forms, it has _____.
a. Inheritance
b. Scalability
c. Encapsulation
d. Polymorphism
(16) What term is used to describe the internal representation of an object that is hidden from view
outside the object's definition?
a. Encapsulation
b. Expandable
c. Polymorphism
d. Inheritance
(17) What programming language model is organized around "objects" rather than "actions"?
a. Java
b. OOB
c. Perl
d. C+
(18) What are the instructions called that tell a system what, how, and when to do something?
a. Object-oriented technology approach
b. Object-oriented database
c. Program
d. Database management
(19) What common technique attempts to save time and energy by reducing redundant work in object-
oriented programming?
a. Reduce lines of programming
2
b. Reuse of code
c. Reduce size of systems being developed
d. Merging different systems together
(20) What kind of programming language is Java?
a. Object-oriented programming language
b. Relational programming language
c. Sixth-generation programming language
d. Database management programming language
(21)
public class Loop {
    public static void main(String[] args) {
         Integer a=012,b;
         for(b=0;b<=a;b++);
         System.out.print(b);
    }
}
What will be the output of above java program?
(a)10
(b)11
(c)12
(d) Compiler error

(22)
public class Loop {
    public static void main(String[] args){
         int b=0;
         do{
            int a=2;
            b++;
            System.out.println(a++);
         }
         while(b!=3);
    }
}
What will be the output of above java program?
(a)2
   2
   2
(b)3
   3
   3
(c)3
   4
   5
(d) Declaration is not allowed here, Compiler error

(23)
public class Loop {
    public static void main(String[] args){
         for(int a=0,b=0;a+b<5;a++,++b){
             System.out.print(a^b);
         }
    }
}
What will be the output of above java program?
(a)111

3
(b)000
(c)1111
(d)Compiler error

(24)
public class Loop {
    public static void main(String[] args){
        int i=0;
        for(;i<4;i++){
          System.out.println(i<2);
         }
    }
}

What will be output of above program?

(a)Infinite loop
(b) true
    false
    false
    false
(c) true
    true
    false
    false
(d)Compiler error

(25)
public class Loop {
    public static void main(String[] args){
    int i=0;
        for(i++;i<4;i++){
          System.out.println(~i);
        }    }
}
What will be the output of above java program?
(a)-1
   -3
(b)-2
(c)-2
   -3
   -4
1. a 13. a
(d)Compiler error
2. b 14. c
ANSWER KEY (OOPs+JAVA TCS: 304)
3. c 15. d

4. a 16. a

5. b 17. b

6. d 18. c

7. b 19. b

8. a 20. a
4
9. c 21. b

10. a 22. a
Section B: Subjective
1. Describe OMT methodology in brief.
2. Differentiate between SA/SD and JSD methodologies.
3. Write short note on Functional modeling
4. Briefly describe how Object Oriented techniques can be applied in other areas like language design and
hardware design.
5. Prepare a Data Flow Diagram for computing the mean of a sequence of input values. A separate control
input is provided to reset the computation. Each time a new value is input, the mean of all values input since
the last reset command should be output.
6. What is JVM. Explain in detail along with structure.
7. What is encapsulation? Explain with the help of an example using JAVA.
8. Discuss the benefits and applications of OOP in detail.Differentiate between object-based and object-
oriented programming languages.
9. What are constraints? Explain in context of object modeling
10. Differentiate between aggregation and generalization by taking suitable example
11. What is a state diagram? Prepare a state diagram for a programmable thermostat
12. Describe the concept of candidate key by taking suitable example
13. Prepare a class diagram from instance diagram given below :

(Country) Borders (Country) Borders (Country)


Spain France Belgium

14. What is JVM? Why is it needed?


15. What is an event? What is the event delegation model? List various mouse and keyboard events.
16. What is the difference between final, finally and finalize keywords in JAVA?
17. What is the life cycle of an Applet? Explain each state of Applet in brief.
18. What are the differences between Swing and AWT?
19. What are the features of Java? Explain in brief.
20. What are the shortcomings of procedure oriented programming? Explain how does Object oriented
programming overcome these shortcomings.
21. Explain method overloading and overriding with examples.
22. How do we design a user-defined package? What are the steps to add classes and interfaces in the package?
Give suitable example.
23. Explain the advantages of using interfaces in Java? How they are different from Abstract Classes?
24. What are Applets? Explain how applets are different from an application.
25. Write a super class Worker and subclasses HourlyWorker and SalariedWorker. Every worker has a name
and a salary rate. Write a method computePay(int hours) that computes the weekly pay for every worker.
An hourly worker gets paid the hourly wage for the actual number of hours worked, if hours is at most 40.
If the hourly worker worked more than 40 hours, the excess is paid at time and a half. The salaried worker
gets paid the hourly wage for 40 hours, no matter what the actual number of hours is. Write a static method
that uses polymorphism to compute the pay of any worker. Supply a test program that tests these classes
and methods.
26. How inter thread communication is done in Java? Write a java program to create Multithreads with
different priorities.
27. What is importance of exception handling mechanism in Java? Define and distinguish checked and
unchecked exceptions.
5
28. What do you mean by constructor overloading in java? Explain with an example. List special properties of
constructors.
29. Describe different types of inheritance in Java. Demonstrate through a java program, how to achieve run
time polymorphism in Java?
30. What is the difference between String, StringBuffer and StringBuilder? Also explain when to use them.
Why String class is final or immutable?
31. Define an interface using JAVA that contains a method to calculate the perimeter of an object. Define two
classes-circle and Rectangle with suitable fields and methods.
32. Explain Method overloading & Method overriding with suitable example. Can you overload operators in
java?
33. Discuss basic in-built packages in java and their uses in application development in brief. Which package is
the default package?
34. Explain Multithreading. In how many ways java implements multithreading? Explain at least one of these
ways with appropriate example
35. What is an exception? What are different exceptions in Java? Explain how you can handle exception in
JAVA with the help of an example using try-catch-finally block.
36. Explain different types of Layout Manager (Flow Layout, Grid Layout, and Border Layout) available in
Java with help of an example of each.
37. Discuss class hierarchy of javax.Swing package. List Three Controls of this package along with their use.
38. Write short notes on the following:
a) JDBC
b) Dynamic bill board applet
c) Lavatron applet
d) scrabblets
39. Write a procedure to create and import the package in Java program. Which event handling model is used
by Java and why?
40. Write short notes on the following
(i) Java API packages.
(ii) AWT controls.
(iii) Adapter classes.
(iv) Servlets.
(v) Event Listener Interfaces.

You might also like