Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
JAVA PROGRAMMING - 16UEC624
K1 LEVEL
UNIT I
1. Who introduced the java_________
a) Milton b) Keller
c) James Gosling d) Peter
2. Old name of java_________
a) Turbo b) Borland
c) Javascript d) Oak
3. Expand JDK.
a) Java Disk Kit
b) Java Development Kit
c) Java Disk Keyword
d) Java Development Keyword
4. Which year java introduced________
a) 1990 b) 1992
c) 1988 d)1995
5. Java is designed for the distributed environment of the ______.
a) Internet b)Extranet c)Intranet d)None Of The Above
6. Java is a ____________
a) Low-Level Programming Language
b) High-Level Programming Language
c) Machine Level Programming Language
d) Assembly Language
7. Java originally developed by ______________
a) Sun Microsystems
b) Microsystems
c) Lotus Microsystems
d) Microsystems lab
8. Java runs on a variety of ___________
a)Platforms b) Forms c)Stream d) Above All
9. Java platform _____
a) (Java [J2SE]) b) Java 1.0 [J2])
c) (Java 1.0 [J2SE]) d)all the above
10. Java is guaranteed to be _________
a) Read one
b) Write one
c) Run and compile
d) Write Once, Run Anywhere.
11. Java can be easily _____ since it is based on the _________.
a) Extended, Object Model
b)Object
c) Model
d) None Of The Above
12. In Java, everything is an ________.
a) Class b) Object c)Static d) Public
13. Java is designed to be__________.
a) Easy To Learn b) Difficult c) Problematic d) None of these
14. Java's secure feature it enables to develop _______________.
a) Encryption
b) Virus-Free, Tamper-Free Systems
c) Virtual
d) Protected
15. java authentication techniques are based on ___________.
a) Public-Key Encryption
b) Private
c) Virtual
d) Static
16. What is correct syntax for main method of a java class?
a) Public Static Int Main(String[] Args)
b) Public Int Main(String[] Args)
c) Public Static Void Main(String[] Args)
d) None Of The Above.
17. Java's multithreaded feature it is possible to write programs that can perform ______.
a) Multi Media
b) Many Tasks Simultaneously
c) Implementation Dependent
d) Runtime Checking
18. What is the output of relational operators?
a) Integer b) Boolean
c)Character d) Double
19. java development process is more ___________.
a) Rapid And Analytical b) Speed
c) Service d) Others
20. java linking is an _________________.
a) Incremental And Light-Weight Process
b) Rapid And Analytical
c) Class Is A Special Data Type
d) Class Is A Special Data
UNIT II
1. Object is an _________ of a class.
a) Instance b) Implement.
c) Inheritance. D) Invoke
2. Class is a ______ entity.
a) Logical. b) Physical.
c) Up Normal d) Collection Of
3. Which of these keywords is used to make a class?
a) Class b) Struct c) Int d) Array.
4 . A _______ object cannot be modified after it is created.
a) Double b) Int. c) String d) Main
5. A ____ class may not have any abstract method.
a) Abstract b) Static c) Final d) Public
6. Str stands for__________
a) Static b) String
c) Standard d) Structure
7. Class is________
a) A collection of variables and methods
b) A collection of variables
c) A collection of values
d) A collection of methods
8. Which statement is not true in java language?
a) A public member of a class can be accessed in all the packages.
b) A private member of a class cannot be accessed by the methods of the same class.
c) A private member of a class cannot be accessed from its derived class.
d) A protected member of a class can be accessed from its derived class.
9. To prevent any method from overriding, we declare the method as,
a) Static b) Const c) Final d) Abstract
10. Which one of the following is not true?
a) A class containing abstract methods is called an abstract class.
b) Abstract methods should be implemented in the derived class.
c) An abstract class cannot have non-abstract methods.
d) A class must be qualified as ‘abstract’ class, if it contains one abstract method.
11. What is the return type of Constructors?
a. Int b. Float
c. Void d. None of the Mentioned
12. What is printed by the following statement? System.out.print(“Hello,\nworld!”);
a) Hello, \nworld! b) Hello, world!
c) “Hello,\nworld!” d) “Hello, \nworld!”
13. Which of the following is valid for if statement?
a. An integer expression b. A Boolean expression
c. A character expression d. A legal expression
14. A constructor
a) Must have the same name as the class it is declared within.
b) Is used to create objects.
c) May be declared private
d) (a), (b) and (c) above.
15. The default value of a static integer variable of a class in Java is,
(a) 0 (b) 1 (c) Garbage value (d) Null
16. 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.
17. A protected member can be accessed in,
a) a subclass of the same package b) a non-subclass of the same package
c) a non-subclass of different package d) a subclass of different package
Which is the false option?
18) Members of a class specified as ……………….. are accessible only to methods of that class.
a) Protected b) Final c) Public d) Private
19. An abstract data type typically comprises a …………… and a set of ………………
respectively.
a) Data representation, classes b) Database, operations
c) Data representation, objects d) Data representation, operations.
20. In a class definition, the special method provided to be called to create an instance of that
class is known as a/an
a) Interpreter b) Destructor c) Constructor d) Object
UNIT III
1. In java, objects are passed as
a) Copy of that object b) Method called call by value
c) Memory address d) Constructor
2. One interface can inherit another by use of the keyword _____.
a) Public b)Extends.
c) Method Name. d) Class Name.
3. A package is a collection of ______.
a) Keywords b) Classes And Interfaces.
c) Editing Tools d)Views
4.A class that cannot be instantiated directly____________
A) Derived Class B) Base Class
C) Main Class D)Abstract Class
5. Consider the following statements about Java packages:
a) Packages don’t provide a mechanism to partition all class names into more manageable
chunks.
b) Packages provide a visibility control mechanism.
c) One of the important properties of a package is that all classes defined inside a
package is accessible by code outside that package.
d) The .class files for classes declared to be part of a package can be stored in multiple
directories.
6. What is a marker interface?
a) Marker interface is an interface with no method.
b) Marker interface is an interface with single method, mark().
c) Marker interface is an interface with single method, marker().
d) None of the above.
7. Which of the following is not true?
a) An interface can extend another interface.
b) A class which is implementing an interface must implement all the methods of the
interface.
c) An interface can implement another interface.
d) An interface is a solution for multiple inheritance in java.
8. The correct order of the declarations in a Java program is,
a) Package declaration, import statement, class declaration
b) Import statement, package declaration, class declaration
c) Import statement, class declaration, package declaration
d) Class declaration, import statement, package declaration
9. Array meaning ______________.
a) A List Of Values Of The Same Type
b) Values Of The Type
c) Static Type
d) All The Above
10. A keyword used to make one class a subclass of another
a) Interpreter b) copy c) Extends d) Object
11. Running more than one computer program concurrently is_______
a) Abstract b) Static c) Multitasking d) Public
12. When an overridden method is called from within a subclass, it will always refer to the
version of that method defined by the
a) Super class
b) Subclass
c) Compiler will choose randomly
d) Interpreter will choose randomly
13. Multiple inheritance means,
a) One Class Inheriting From More Super Classes
b) More Classes Inheriting From One Super Class
c) More Classes Inheriting From More Super Classes
d) None of The Above
14. A class that inherits from a base class__
a) Derived Class b) Private Class
c) Static Class d) None Of The Above
15. A generalization of another class_____
a) Subclass b) Derived Class
c) Private Class d) Super Class
16. An interface that allows a class the ability to run in a distinct thread without being a subclass
of thread is______
a) Subclass b) Derived interface
c) Private member d) Runnable interface
17.An exception thrown by the system in response to unexpected problem when a program is
running is called________
a) Runnable exception b) Error
c) interface d) thread
18. A class that inherits methods and variables from another class is_____
a) Subclass b) Derived Class
c) Private Class d) Super Class
19. An array that is set up much like a table, with a specific number of _____
a) Columns and rows b) column
c) Rows d) Others
20. A class that implements an interface provides implementations for all the methods in the
____________
a) Runnable exception b) Error
c) interface d) thread
UNIT IV
1. Thread is_____________
a) A single path of execution that is a sub process of the main process
b) A single path of execution that is a sub process
c) A single path of execution that is a main process
d) A single path of execution that is a process
2. Which of the following statements about Java Threads is correct?
a) Java threads don’t allow parts of a program to be executed in parallel
b) Java is a single-threaded language
c) Java’s garbage collector runs as a high priority thread
d) Ready, running and sleeping are three states that a thread can be in during its life cycle
3.______Code that responds to and attempts to recover from exception.
a) Compile Smoothly b) Exception handler
c) Implement Smoothly d) Control
4. Exception is________
a) Usually An Error
b) Line Of Program
c) Syntax Of Program
d) All The Above
5. Multithreaded feature allows the developers to construct interactive applications that can
_____________.
a) Compile Smoothly b) Run Smoothly
c) Implement Smoothly d) Control
6. All exception types are subclasses of the built-in class
a) Exception b) Runtime Exception c) Error d) Throwable
7. In Java, a try block should immediately be followed by one or more ……………….. blocks.
a) Throw b) Run c) Exit d) Catch
8. ______ is a small unit of a process.
a) Method b) Thread
c) Applet d) Stream
9. The ________ statement is used to terminate a statement sequence.
a) Break. b)Switch.
c) Continue. d)Wait.
10.___________ are the wrongs that can make a program go wrong.
a) Exception b) Run c) Exit d) Error
11. Errors may broadly be classified into________categories.
a) 1 b) 2 c) 3 d) 4
12. All syntax errors will be detected and disp[layed by the java compiler and therefore these
errors are known as__________
a) Compile time error b) Static
c) Continue. d) Runtime
13. Packages act as _______for classes.
a) Containers b) server
c) Continue d) Client
14. Language utility classes such as vectors,hash tables,random numbers,date are ______
a) Java.util b) java.awt
c) java.apt d) java.net
15. Header file used for input/output support is______________
a) Java.io b) java.awt
c) java.apt d) java.net
16. Header file used classes for networking is______________
a) Java.io b) java.awt
c) java.apt d) java.net
17. Packages can be named using the standard java_________
a) Naming rules b) Server
c) Continue d) Client
18. A thread is always in one of these _____state.
a) Five b) Six
c) One d) Ten
19. _________________means that the processor has given its time to the thread for its
execution.
a) Running b) Newborn
c) Continue d) Client
20. Every thread has a ________
a) Life cycle b) Second
c) Third d) Time
UNIT V
1. Applet is___________
a) A java program that is embedded in an HTML document
b) A multitasking
c) A java program that is embedded
d) All the above
2) An applet cannot be viewed using
a) Netscape navigator
b) Microsoft Internet Explorer
c) Sun’ Hot Java Browser
d) Applet viewer tool which comes, with the Java Development Kit.
3. In Java, a character constant’s value is its integer value in the ………………………character
set.
a) EBCDIC b) Unicode c) ASCII d) Binary
4. <BR> means
a) Break line b) String line
c) Vertical rule d) Horizontal rule
5. Expand URL
a) Uniform Resource Locator
b) Union Resource Locator
c) Uniform Resource Location
d) Uniform Reason Locator
6. Para tag
a) <h> b) <p> c) <s> d)<i>
7. .<HR> means
a) Applet Line
b) String Line
c) Vertical Rule
d) Horizontal Rule
8. _____________ used to add hyper links.
a) <A> b) <S> c) <H> d) <K>
9. Applet enters the _________state when it is first loaded
a) Applet Line
b) Stop
c) Vertical Rule
d) Initialization
10. The paint( ) method, which requires a _______as an argument
a) Applet Line
b) Stop
c) Vertical Rule
d) Graphics object
11. A________tool created by SUN to run applets without a browser.
a) Applet viewer b)vApplet c) cspace d) space
12. An attribute of the HTML<APPLET> tag that specifies the amount of vertical space between
the applet and the text on the page____________
a) hspace b)vspace c) cspace d) space
13. An attribute of the HTML<APPLET> tag that specifies the amount of horizontal space
between the applet and the text on the page____________
a) hspace b)vspace c) cspace d) space
14. An applet that is stored on the local computer system than somewhere else on the internet
a) Local applet b) Applet viewer c)vApplet d) cspace
15.Expand API.
a) Application Programming Interface b) Programming Interface
c) Interface d) Package
16. Expand AWT.
a) Abstract Windowing Toolkit b) Abstract Toolkit
c) Protected d) Public
17.Building an applet code
a) java file b) java file c) javac file d) javap
18.A ____________is a collection of related records.
a) File b)Form c) Object d)Class
19.A java streams are classified into _____
a) 3 b)2 c)4 d)5
20. IO stream means
a) Input Output Stream b) Input Stream
c) Output Stream d) all the above
JAVA PROGRAMMING - 10UEC28
K2 LEVEL
UNIT I
1. Why Java is platform independent?
Platform independent practically means “write once run anywhere”. Java is called so
because of its byte codes which can run on any system irrespective of its underlying operating
system.
2. Expand JDK
It stands for Java Development Kit.
3. Expand JRE
It stands for Java Runtime Environment.
4. Expand JVM
It stands for Java Virtual Machine.
5. What is mean by public?
Public is an access modifier, which is used to specify who can access this method. Public
means that this Method will be accessible by any Class.
6. What is mean by static ?
It is a keyword in java which identifies it is class based i.e it can be accessed without
creating the instance of a Class.
7. What is mean by void?
It is the return type of the method. Void defines the method which will not return any
value.
8. What is mean by main?
It is the name of the method which is searched by JVM as a starting point for an
application with a particular signature only. It is the method where the main execution occurs.
9. What is mean by String args[] ?
It is the parameter passed to the main method.
10. What are wrapper classes?
A wrapper class converts the java primitives into the reference types (objects). Every
primitive data type has a class dedicated to it. These are known as wrapper classes
UNIT II
1. What are constructors in Java?
In Java, constructor refers to a block of code which is used to initialize an object. It must
have the same name as that of the class. Also, it has no return type and it is automatically called
when an object is created.
2. List out the types of constructors.
There are two types of constructors:
1. Default constructor
2. Parameterized constructor
3. What is Array List?
Array List is not synchronized. Array List is fast as it’s non-synchronized.
4. What is method overloading?
Methods of the same class shares the same name but each method must have different
number of parameters or parameters having different types and order. It is to “add” or “extend”
more to method’s behavior.
5. What is method Overriding?
Method Overriding, sub class have the same method with same name and exactly the
same number and type of parameters and same return type as a super class.It is to “Change”
existing behavior of method.
6. What are Loops in Java?
Looping is used in programming to execute a statement or a block of statement
repeatedly.
7. How many types of loops in java?
There are three types of loops
1) For Loops
2) While Loops
3) Do While Loops
8. What is mean by For Loops?
For loops are used in java to execute statements repeatedly for a given number of times.
For loops are used when number of times to execute the statements is known to programmer.
9. What is mean by While Loops?
While loop is used when certain statements need to be executed repeatedly until a
condition is fulfilled. In while loops, condition is checked first before execution of statements.
10. What is mean by Do While Loops?
Do While Loop is same as While loop with only difference that condition is checked after
execution of block of statements. Hence in case of do while loop, statements are executed at least
once.
UNIT III
1. What is mean by Interfaces?
An interface cannot provide any code at all,just the signature. A Class may implement
several interfaces. All methods of an Interface are abstract. An Interface cannot have instance
variable
2. What is multiple inheritance?
If a child class inherits the property from multiple classes is known as multiple
inheritance. Java does not allow extending multiple classes.
3. What is mean by Error?
An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error.
4. What is mean by Exception?
Exceptions are conditions that occur because of bad input or human error etc.
5. How can you handle Java exceptions?
There are five keywords used to handle exceptions in java:
1. try
2. catch
3. finally
4. throw
5. throws
6. What is mean by Final?
Final is used to apply restrictions on class, method and variable. Final class can’t be
inherited, final method can’t be overridden and final variable value can’t be changed.
7. What is mean by Finalize?
Finalize is used to perform clean up processing just before object is garbage collected.
8. What is mean by Private?
Method,Field can be accessed from the same class to which they belong.
9. What is mean by Protected?
Method,Field can be accessed from the same class to which they belong or from the sub-
classes,and from the class of same package,but not from outside.
10. What is mean by Default?
Method,Field,class can be accessed only from the same package and not from outside of
it's native package.
UNIT IV
1. What are Java Packages?
Package is a collection of classes and interfaces which are bundled together as they are
related to each other.
2. What's the significance of packages?
Use of packages helps developers to modularize the code and group the code for proper
re-use. Once code has been packaged in Packages, it can be imported in other classes and used.
3. What are the performance implications of Interfaces over abstract classes?
Interfaces are slower in performance as compared to abstract classes as extra indirections
are required for interfaces. Another key factor for developers to take into consideration is that
any class can extend only one abstract class while a class can implement many interfaces.
4. Does Importing a package imports its sub-packages as well in Java?
In java, when a package is imported, its sub-packages aren't imported and developer
needs to import them separately if required.
5.What is the difference between continue and break statement?
Break and continue are two important keywords used in Loops. When a break keyword is
used in a loop, loop is broken instantly while when continue keyword is used, current iteration is
broken and loop continues with next iteration.
6. What's the base class in Java from which all classes are derived?
java.lang.object
7. Can main() method in Java can return any data?
Main() method can't return any data and hence, it's always declared with a void return
type.
8. What is two-dimensional array?
An array that is set up much like a table, with a specific number of Columns and rows
9. What is derived class?
A class that inherits from a base class is Derived Class.
10. What is Runnable interface?
An interface that allows a class the ability to run in a distinct thread without being a
subclass of thread is Runnable interface.
UNIT V
1. What is Applet?
A java program that is embedded in an HTML document
2. What is Unicode?
In Java, a character constant’s value is its integer value in the Unicode character set.
3. What is Applet viewer?
A Applet viewer tool created by SUN to run applets without a browser.
4. What is vspace?
An attribute of the HTML<APPLET> tag that specifies the amount of vertical space
between the applet and the text on the page.
5. What is hspace?
An attribute of the HTML<APPLET> tag that specifies the amount of horizontal space
between the applet and the text on the page.
6. What is Local applet?
An applet that is stored on the local computer system than somewhere else on the
internet.
7. Expand API.
Application Programming Interface
8. Expand AWT.
Abstract Windowing Toolkit
9. What is Remote applet?
An applet that is stored on the another computer system and which must be downloaded
to the local computer over the internet.
10. What is Attribute?
A specified foe an HTML tag (for example, code is an attribute of the <APPLET>tag .
JAVA PROGRAMMING - 10UEC28
K3 LEVEL
UNIT I
1. Enumerate the rules for creating identifiers in java.
2. What are command line arguments ? How are the useful?
3. How are constants and variables important in developing programs?
4. What is type casting? Why is it required in programming.
5. Describe in details the step involved in implementing a stand -alone program
UNIT II
1. Examine the decision making and branching statements.
2. What are objects? How are they created from a class.
3. Discuss the overriding of methods.
4. Explain the abstract methods and classes.
5. Write short note on
i) Defining a class ii) Adding variables iii) Adding methods iv) Creating
objects
UNIT III
1. What is a package? Explain the adding a class to a packages.
2. Explain the extending interfaces.
3. Briefly explain the meaning of an Array.
4. Briefly explain the string methods.
5. Examine the array in java and its types.
UNIT IV
1. What is the difference between multiprocessing and multithreading? What is to be done to
implement these in a program?
2. What are the two methods by which we may stop threads?
3. Describe the complete life cycle of a threat.
4. What is an exceptions? and its uses.
5. How do we set priorities for threads?
UNIT V
1. How many catch blocks can we use with one try block?
2. What is an applet ? explain it.
3. Explain the client /server relationship as applied to java applets.
4. Discuss the steps involved in developing and running a local applet.
5. Discuss the steps involved in loading and running a remote applet.
JAVA PROGRAMMING - 10UEC28
K4 LEVEL
UNIT I
1. What is a token? List the various types of tokens supported by java.
2. Describe the structure of a typical java program.
3. List the eight basic data types used in java. Give examples
4. What is mean by Operator? Briefly explain the various Types of Operators.
5. What is a statement? And explain its types.
UNIT II
1. Explain the decision making with branching statements in java.
2. In what ways does a switch statement differ from an if statement?
3. Briefly explain the While, Do, and for statements with examples.
4. Write short note on
a) Defining a class b) Adding variables
c) Adding methods d) Creating objects
5. Compare and contrast overloading and overriding methods.
UNIT III
1. Write short note on
a) String array b) String method
c) String buffer class
2. Discuss the Naming Conventions of Packages.
3. Explain the creating an Array.
4. Describe the various forms of implementing Interfaces.
5.Why are arrays easier to use compared to bunch of related variables?
UNIT IV
1. What is multithreading? How does it improve the performance of java?
2. Explain how exception handling mechanism can be used for debugging a program.
3. What is the difference between suspending and stopping a thread?
4. List some of the most common types of exceptions that might occur in java. Give examples.
5. Develop a simple real life application program to illustrate the use of multithreads.
UNIT V
1. Describe the different stages in the lifecycle of an applet. Distinguish between init() and
start() methods.
2. How do applets differ from application programs.
3. Compare and contrast overloading and overriding methods.
4. What is a Stream? How is the concept of Streams used in Java?
5. Why do applet classes need to be declared as public?