Java aptitude questions pdf

Tuesday, April 30, 2019 admin Comments(0)

5) Difference between method overloading and method overriding in java? . .. 9. 6) Difference . Core java Interview questions on Coding Standards. Latest JAVA Aptitude Interview Questions for Freshers. If you going for interview then prepare for JAVA aptitude using these questions and get help to solve. Question: What are the two parts of a value of type double? Answers: Question: Page in the Course Pack has a set of rules for Java.

Language: English, Spanish, Japanese
Country: Dominica
Genre: Academic & Education
Pages: 463
Published (Last): 04.12.2015
ISBN: 554-2-17036-281-5
ePub File Size: 16.47 MB
PDF File Size: 16.55 MB
Distribution: Free* [*Regsitration Required]
Downloads: 24411
Uploaded by: RANDEE

Java Aptitude Questions in for more Java Aptitude Questions to download in pdf format. PDF | This book is intended to serve those who have just started in the “gaps” by answering several „wh y‟ and „how to‟ questions in Java. Java Programming questions and answers with explanation for interview, download Java Programming quiz questions with answers as PDF files and eBooks.

Object class 8 What is the mechanisam defind by java for the Resources to be used by only one Thread at a time? They can appear in any order e. UTF characters are represented using only bits. Explain them? String Integer Boolean Character Ans: It enables event handling by objects other than the ones that generate the events. The Serializable interface extends the Externalizable interface.

C Aptitude Question Answer. Data Warehousing Interview Questions and Answers. DotNet Framework Question and Answer.

Dotnet based technical interview question. Eectronics Questions. Hibernate Interview Questions. Java Interview Question and Answers 1. Java interview questions and answers 2. Java interview questions and answers 3.

Technical Aptitude Questions Answer Free Interview Papers

Knight Coders Sample Questions. Oracle DBA interview questions. Oral quiz questions and answers. People-soft Certification Questions answers. Practice Test Exam Questions and Answers. Model Questions on Aptitude Tests. Solaris Admin Interview Questions Answers. SQL interview question with answer. Two parts in executing a Java program are: Java Compiler and Java Interpreter. The Java Compiler is used for compilation and the Java Interpreter is used for execution of the application.

Is the Mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. Is the process by which one object acquires the properties of another object.

Is a feature that allows one interface to be used for a general class of actions. Java source code file.

It must have a package statement It must be named Test. Identifiers are used for class names, method names and variable names. Constructor will be automatically invoked when an object is created. Whereas method has to be call explicitly. Bin contains all tools such as javac, applet viewer, awt tool etc. Variables are locations in memory that can hold values. Before assigning any value to a variable, it must be declared.

What are their uses? Java has three kinds of variables namely, the instance variable, the local variable and the class variable. Local variables are used inside blocks as counters or in methods as temporary variables and are used to store information needed by a single method.

Instance variables are used to define attributes or the state of a particular object and are used to store information needed by multiple methods in the objects. Class variables are global to a class and to all the instances of the class and are useful for communicating between different objects of all the same class or keeping track of global states.

Variables can be declared anywhere in the method definition and can be initialized during their declaration. They are commonly declared before usage at the beginning of the definition. Variables with the same data type can be declared together. Local variables must be given a value before usage. Variable types can be any data type that java supports, which includes the eight primitive data types, the name of a class or interface and an array.

How many types of literals are there? A literal represents a value of a certain type where the type describes how that value behaves. There are different types of literals namely number literals, character literals, boolean literals, string literals,etc. An array is an object that stores a list of items.

Array variable indicates the type of object that the array holds. A combination of characters is called as string.

Java Programming Questions and Answers

String[ ] s; String [ ]s: String[ s]: String s[ ]: The array subscript expression can be used to change the values of the elements of the array. If a variable is declared as final variable, then you can not change its value. It becomes constant. Static variables are shared by all instances of a class. Operators are special symbols used in expressions. The following are the types of operators: It returns the reminder of dividing the first operand by second operand.

Yes 10 Can a byte object be cast to a double value? An object cannot be cast to a primitive value. Order of precedence the order in which operators are evaluated in expressions. Associativity determines whether an expression is evaluated left-right or right-left.

The prefix form returns the increment or decrement operation and returns the value of the increment or decrement operation. The postfix form returns the current value of all of the expression and then performs the increment or decrement operation on that value.

The double value 8. The String "5. The value assigned is 20 3 The switch statement does not require a break. The break keyword halts the execution of the current loop and forces control out of the loop. The continue is similar to break, except that instead of halting the execution of the loop, it starts the next iteration. A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur.

The do statement will always execute the body of a loop at least once. Dot notation. When an object is no longer referred to by any variable, Java automatically reclaims memory used by that object. This is known as garbage collection. Methods are functions that operate on instances of classes in which they are defined.

Objects can communicate with each other using methods and can call methods in other classes. Method definition has four parts. They are name of the method, type of object or primitive type the method returns, a list of parameters and the body of the method.

A method's signature is a combination of the first three parts mentioned above. Calling methods are similar to calling or referring to an instance variable. These methods are accessed using dot notation. This class is defined in the object class and is available to all objects. To import a class, the import keyword should be used as shown.

A constructor is a special kind of method that determines how an object is initialized when created. Casting is bused to convert the value of one type to another.

Explicit cast. Specific cast. The class declaration b. The access modifiers c.

The use of pointers Ans: They must precede a class's data variables or methods c. They can follow a class's data variables or methods d. They can appear in any order e. They must be applied to data variables first and then to methods Ans: Can this instance variable be manipulated by methods out side its class?

It is accessible to all other classes in the hierarchy b. It is accessablde only to subclasses of its parent class c. It represents the public interface of its class d. The only way to gain access to this method is by calling one of the public class methods Ans: Public instance variables b. Private instance variables c. Public methods d.

Private methods Ans: Each new object has its own distinctive set of instance variables b. Each object has a copy of the instance variables of its class c. The instance variables of each object are stored together with the variables of other objects Ans: It enables you to access instance variables of any objects within a class b. It enables you to store values in instance variables of an object c. It is used to call object methods d. It is to create a new object Ans: The instance variables of a class only b.

The methods of a class only c. The instance variables and methods of a class Ans: The new operator b. The instanceof operator c. The dot operator Ans: When the default constructor is not called b. When the name of the constructor differs from that of the class c. When there are no constructors for the class Ans: A class may have only one finalize method b. Finalizers are mostly used with simple classes c. Finalizer overloading is not allowed Ans: When class is declared public.

A class is a subclass itself. Inner class Anonymous classes Method overloading Method overriding Ans: The package statement defines a name space in which classes are stored.

Questions pdf aptitude java

If you omit the package, the classes are put into the default package. Applet" and "java. Applet" will import only the class Applet from the package java. Anything declared as public can be accessed from anywhere private: It is visible to subclasses as well as to other classes in the same package. What is use of interface? Methods declared in interface are abstract methods. We can implement many interfaces on a class which support the multiple inheritance.

All the methods have to be implemented. Yes we can define a variable in an interface. They are implicitly final and static. All the methods declared inside an Interface are abstract. Where as abstract class must have at least one abstract method and others may be concrete or abstract. In Interface we need not use the keyword abstract for the methods.

True 10 Java compiler stores the. If no, why? If yes, how? None 22 Can you extend an interface? Yes 23 Is it necessary to implement all the methods of an interface while implementing the interface? No 24 If you do not implement all the methods of an interface while implementing , what specifier should you use for the class? Using interfaces. If so, what are the modifiers?

If so, how? Declare the class as abstract. Exceptions that are thrown by java runtime systems can be handled by Try and catch blocks. With throw exception we can handle the exceptions thrown by the program itself.

If a method is capable of causing an exception that it does not handle, it must specify this behavior so the callers of the method can guard against that exception. Exception and Error are the subclasses of the Throwable class. Exception class is used for exceptional conditions that user program should catch. With exception class we can subclass to create our own custom exception.

Error defines exceptions that are not excepted to be caught by you program. Example is Stack Overflow. Freeing up other resources that might have been allocated at the beginning of a method. Finally block will execute whether or not an exception is thrown. If an exception is thrown, the finally block will execute even if no catch statement match the exception. If so when? It will go for Garbage Collector. And frees the memory.

We can define multiple exceptions in throws clause. Signature is.. True 10 The subclass exception should precede the base class exception when used within the catch clause. True 11 Exceptions can be caught or rethrown to a calling method.

JAVA Questions and Answers

True 12 The statements following the throw keyword in a program are not executed. True 13 The toString method in the user-defined exception class is overridden. Thread-based 2 What are the two ways to create the thread? Object class 8 What is the mechanisam defind by java for the Resources to be used by only one Thread at a time? Synchronisation 9 What is the procedure to own the moniter by many threads? False 16 Which priority Thread can prompt the lower primary Thread?

Higher Priority 17 How many threads at a time can access a monitor? False 20 The run method should necessary exists in clases created as subclass of thread? True 21 When two threads are waiting on each other and can't proceed the programe is said to be in a deadlock?

True 22 Which method waits for the thread to die? D 24 Garbage collector thread belongs to which priority? Timeslicing is the method of allocating CPU time to individual threads in a priority schedule.

In java runtime, what is it's role? Daemon thread is a low priority thread which runs intermittently in the background doing the garbage collection operation for the java runtime system. A super class is a class that is inherited whereas subclass is a class that does the inheriting.

When superclass is declared as private. Object class 6 Object class is a superclass of all other classes?

True 7 Java supports multiple inheritance? False 8 What is inheritance? Deriving an object from an existing class. In the other words, Inheritance is the process of inheriting all the features from a class 9 What are the advantages of inheritance?

Reusability of code and accessibility of variables and methods of the superclass by subclasses. It must provide all of the methods in the interface and identify the interface in its implements clause.

Java Programming Objective Type Questions | PDF Download | | Page 1

False 17 Declaration of methods as final results in faster execution of the program? True 18 Final variables should be declared in the beginning? True 19 Can we declare variable inside a method as final variables?

Cannot because, local variable cannot be declared as final variables. An abstract class may not be declared as final. A class does not inherit constructors from any of it's super classes. Two methods may not have the same name and argument list but different return types. Overridden methods must have the same name , argument list , and return type. The overriding method may not limit the access of the method it overridees.

The overriding method may not throw any exceptions that may not be thrown by the overridden method. Which method can be used to obtain the length of the String? How do you concatenate Strings? Which method can be used to compare two strings for equality? Which method can be used to perform a comparison between strings that ignores case differences? What is the use of valueOf method? What are the uses of toLowerCase and toUpperCase methods? The method toLowerCase converts all the characters in a string from uppercase to lowercase.

The method toUpperCase converts all the characters in a string from lowercase to uppercase. Which method can be used to find out the total allocated capacity of a StrinBuffer? Which method can be used to set the length of the buffer within a StringBuffer object? What is the difference between String and StringBuffer? String objects are constants, whereas StringBuffer objects are not.

String class supports constant strings, whereas StringBuffer class supports growable, modifiable strings. What are wrapper classes?

Wrapper classes are classes that allow primitive types to be accessed as objects. Which of the following is not a wrapper class? String Integer Boolean Character Ans: What is the output of the following program? Which of the following methods are methods of the String class?

Which of the following methods cause the String object referenced by s to be changed? String is a wrapper class? LANG java. Cloneable, Comparable and Runnable. What are the constants defined by both Flaot and Double classes? What are the constants defined by Byte, Short, Integer and Long? What are the constants defined by both Float and Double classes? What is the purpose of the Runtime class? The purpose of the Runtime class is to provide access to the Java runtime system.

What is the purpose of the System class? The purpose of the System class is to provide access to system resources. Which class is extended by all other classes? Object class is extended by all other classes.

Pdf questions java aptitude

Which class can be used to obtain design information about an object? Which method is used to calculate the absolute value of a number? What are E and PI? E is the base of the natural logarithm and PI is the mathematical value pi. Which of the following are true? The Class class is the superclass of the Object class.

The Object class is final. The Class class can be used to load other classes. The ClassLoader class can be used to load other classes. Which of the following methods are methods of the Math class? Which of the following are true about the Error and Exception classes?

Both classes extend Throwable. The Error class is final and the Exception class is not. The Exception class is final and the Error is not. Both classes implement Throwable.

The Void class extends the Class class. The Float class extends the Double class. The System class extends the Runtime class.

The Integer class extends the Number class. Min Can't convert java lang Integer d 10 followed by 1 Ans: A Stream is an abstraction that either produces or consumes information. There are two types of Streams. They are: Byte Streams: Byte Streams provide a convenient means for handling input and output of bytes. Character Streams: Character Streams provide a convenient means for handling input and output of characters.

Byte Stream classes: Byte Streams are defined by using two abstract classes. InputStream and OutputStream. Character Stream classes: Character Streams are defined by using two abstract classes. Reader and Writer. Which of the following statements are true?

UTF characters are all 8-bits. UTF characters are all bits. Unicode characters are all bits. Bytecode characters are all bits. When you construct an instance of File, if you do not use the filenaming semantics of the local machine, the constructor will throw an IOException.

When you construct an instance of File, if the corresponding file does not exist on the local file system, one will be created.

When an instance of File is garbage collected, the corresponding file on the local file system is deleted. None of the above. The File class contains a method that changes the current working directory.