Java Interview Quizs Questions 2

Q1. What is the action of rint() in Java

A. Returns the absolute value of the argument

B. Returns the smallest of the two arguments

C. Returns the double value that is closest in value to the argument

D. Returns the largest integer that is less than or equal to the argument

Show Answer Answer:-C. Returns the double value that is closest in value to the argument

Q 2. Which one will returns the absolute value of a

A. rint(a)

B. log(a)

C. abs(a)

D. exp(a)

Show Answer Answer:-C. abs(a)

Q 3. One if or else if statement inside another if or else if statement is

A. if statement

B. if-else statement

C. if-else-if ladder

D. nested if statement

Show Answer Answer:-D. nested if statement

Q 4. Built-in multiway decision statement in Java is known as

A. Switch

B. Oprator

C. Break

D. Continue

Show Answer Answer:-A. Switch

Q 5. Case and break are used in ___

A. Jump

B. if-else

C. nested-if

D. Switch

Show Answer Answer:-D. Switch

Q 6. Which one jump statement is not supported in Java

A. Else

B. Break

C. Return

D. Continue

Show Answer Answer:-A. Else

Q 7. ____ leaves a loop, ____ jumps to the next iteration

A. break,continue

B. continue,break

C. switch,break

D. break,switch

Show Answer Answer:-A. break,continue

Q 8. In Java, the functions are called

A. Fields

B. Methods

C. Operator

D. Class

Show Answer Answer:-B. Methods

Q 9. Header should always be declared independently separated by

A. Dot

B. Slash

C. Commas

D. Pipe

Show Answer Answer:-C. Commas

Q 10. Which one enables an object to initialize itself when it is created

A. Validator

B. Arguments

C. Parameters

D. Constructor

Show Answer Answer:-D. Constructor

Q11. Constructors have the same name as the ________

A. Class

B. Int

C. Void

D. String

Show Answer Answer:-A. Class

Q 12. Method __________ has same name but different parameter list and different definition

A. Binding

B. Overriding

C. Overloading

D. Polymorphism

Show Answer Answer:-C. Overloading

Q 13. Polymorphism in Java is of two tytpes, namely ________ and _______

A. Static type, Dynamic type

B. Start time, End time

C. Run time, Compile time

D. Variable type, Static type

Show Answer Answer:-C. Run time, Compile time

Q 14. Runtime polymorphism is also known as _______

A. Static binding

B. Early binding

C. Dynamic method dispatch

D. Method overloading

Show Answer Answer:-C. Dynamic method dispatch

Q 15. When reference variable of Parent class refers to the object of Child class, then it is known as

A. Side casting

B. Upcasting

C. Top casting

D. Downcasting

Show Answer Answer:-B. Upcasting

Q 16. Polymorphism that is resolved during compiler time is known as

A. Dynamic polymorphism

B. Static polymorphism

C. Special Polymorphism

D. None of the above

Show Answer Answer:-B. Static polymorphism

Q 17. Which one of the followings is false for static method

A. They can only call other static methods

B. They can only access static data

C. They can only access static data

D. They can only access dynamic data

Show Answer Answer:-D. They can only access dynamic data

Q 18. In inheritance, the old class is known as

A. Start class

B. Base class

C. Derived class

D. Sub class

Show Answer Answer:-B. Base class

Q 19. Base class is also known as

A. Super class

B. Child class

C. Sub class

D. Derived class

Show Answer Answer:-A. Super class

Q 20. When a class extends a class, which extends another class then this is called ______ inheritance

A. Single level

B. Two level

C. Multi level

D. Many level

Show Answer Answer:-C. Multi level

Q 21. When more than one child classes have the same parent class then it is called as

A. Single inheritance

B. Multilevel inheritance

C. Class inheritance

D. Hierarchical inheritance

Show Answer Answer:-D. Hierarchical inheritance

Q 22. A class that cannot be subclassed is called a _______

A. Parent class

B. Child class

C. Revised class

D. Final class

Show Answer Answer:-D. Final class

Q 23. Class Subclass-name extends Superclass-name { //methods and fields } This syntax is used for

A. Inheritance

B. Polymorphism

C. Encaptulation

D. All of the above

Show Answer Answer:-A. Inheritance

Q 24. _________ classes cannot be instantiated

A. String

B. Mutable

C. Wrapper

D. Abstract

Show Answer Answer:-D. Abstract

Q 25. ______ is a process of hiding the implementation details and showing only functionality to the user

A. Abstract

B. Network

C. System

D. Anonymous

Show Answer Answer:-A. Abstract

Q 26. ______ is a group of related data items that share a common name with same data type

A. String

B. Array

C. Parameter

D. Arguments

Show Answer Answer:-B. Array

Q 27. Which one of the following is false

A. type arrayname[];

B. arrayname [] type;

C. type [] arrayname;

D. None of the above

Show Answer Answer:-B. arrayname [] type;

Q 28. Which of the following is not a wrapper class

A. Integer

B. Byte

C. Random

D. Short

Show Answer Answer:-A. Integer

Q 29. Which of the following is false

A. It is convenient to use vectors to store objects

B. Vector can be used to store a list of objects that may vary in size

C. Vector ia a StringBuffer

D. We can add and delete objects from the list as and when required

Show Answer Answer:-C. Vector ia a StringBuffer

Q 30. We can use_________ to convert primitive data types to wrapper class types automatically

A. Auto boxing

B. Unboxing

C. Annotations

D. Both A and B

Show Answer Answer:-D. Both A and B

Q 31. ______________ method is used to convert primitive numbers to object numbers in wrapper classes

A. String() Method

B. Constructor Methods

C. Parsing Method

D. None of the above

Show Answer Answer:-B. Constructor Methods

Q 32. ________ gives the number of objects present

A. list.size()

B. list.copyInto(array)

C. list.removeElement(item)

D. Both A and B

Show Answer Answer:-A. list.size()

Q 33. Which are true

A. An interface can sub interfaced from other interface

B. Interface support extending

C. Interface can’t support extending

D. Both A and B

Show Answer Answer:-D. Both A and B

Q 34. _________ package is classes for networking

A. java.io

B. java.net

C. java.awt

D. java.applet

Show Answer Answer:-B. java.net

Q 35. Dead state can be compared with ______ method of applets

A. stop()

B. paint()

C. destroy()

D. init()

Show Answer Answer:-C. destroy()

Q 36. ________ method is used to find out that a thread is still running or no

A. Alive()

B. CheckRun()

C. isAlive()

D. Run()

Show Answer Answer:-C. isAlive()

Q 37. Default value of priority variable MIN_PRIORITY

A. 1

B. 10

C. 100

D. 1000

Show Answer Answer:- A. 1

Q 38. Default value of priority variable MAX_PRIORITY

A. 5

B. 10

C. 50

D. 100

Show Answer Answer:-B. 10

Q 39. Dividing an integer by zero is a ______error

A. Compile

B. Syntax

C. Runtime

D. Logic

Show Answer Answer:-C. Runtime

Q 40. An exception is a condition that is caused by a ________ error in the program

A. Compile

B. Execution

C. Runtime

D. Syntax

Show Answer Answer:-C. Runtime

Q 41. SecurityException is for

A. Caused when there’s not enough memory to allocate a new object

B. Caused when an applet tries to perform an action not allowed by the browser’s security setting

C. Caused when the system runs out of stack space

D. Caused by referencing a null object

Show Answer Answer:-B. Caused when an applet tries to perform an action not allowed by the browser’s security setting

Q 42. Which of the following is true “An applet can play an audio file represented by the AudioClip interface in the java, applet package Causes the audio clip to replay continually for______”

A. public void stop()

B. public void play()

C. public void loop()

D. Both A and B

Show Answer Answer:-C. public void loop()

Q 43. ________ method is called only once during the run time of your applet

A. init()

B. start()

C. stop()

D. destroy()

Show Answer Answer:-A. init()

Q 44. How many reserved keywords are currently defined in the Java language

A. 32

B. 39

C. 45

D. 50

Show Answer Answer:-D. 50

Q 45. Output of relational operators is

A. Short

B. Integer

C. Boolean

D. All of above

Show Answer Answer:-C. Boolean

Q 46. Which operator is used to allocate memory to array variable in Java

A. calloc

B. new

C. malloc

D. None of above

Show Answer Answer:-B. new

Q 47. Which one is not a keyword in Java

A. Private

B. Throw

C. Void

D. Run

Show Answer Answer:-D. Run

Q 48. Which of the following operator in Java have context dependent meaning

A. +

B. ++

C. &

D. All of the above

Show Answer Answer:-D. All of the above

Q 49. Which of the following does not have a superclass in Java

A. System

B. Object

C. Lang

D. Exception

Show Answer Answer:-C. Lang

Q 50. Which of the following statements will result in compilation error in Java

A. signed int abc;

B. unsigned int abc;

C. signed byte abc;

D. All of the above

Show Answer Answer:-D. All of the above

Q 51. In Java Garbage collector frees the programmer from worrying about

A. Memory issues

B. dangling references

C. creating new objects

D. recursion

Show Answer Answer:-B. dangling references

Q 52. In Java, Is null an object

A. Yes

B. No

C. Sometimes Yes

D. None of the above

Show Answer Answer:-B. No

Q 53. Which of the following component is not used to act as a input/output stream in Java

A. file

B. class

C. a pipe

D. array of bytes

Show Answer Answer:-B. class

Q 54. What is the immediate super class of Applet Class

A. Object

B. Window

C. Panel

D. Component

Show Answer Answer:-C. Panel

Q 55. In Javascript each window object has sub-object, which called

A. Features

B. Properties

C. Characteristics

D. Qualifiers

Show Answer Answer:- B. Properties

Q 56. Java ____________ is a language of machine instructions understood by the java virtual machine and usually generated (compiled) from Java language source code.

A. Javap

B. Applet

C. Beans

D. Bytecode

Show Answer Answer:-D. Bytecode

Q 57. Which of the following statement is not true regarding JavaScript

A. Javascript is a loosely typed language

B. Javascript is an object based language

C. Javascript is event driven

D. Javascript embedded in an HTML document is compiled and executed by the client browser

Show Answer Answer:-D. Javascript embedded in an HTML document is compiled and executed by the client browser

Q 58. ______ data structure is used by operating system to manage the recursion in Java

A. Array

B. Queue

C. Tree

D. Stack

Show Answer Answer:-D. Stack

Q 59. Which coding types is used for data type characters in Java

A. ASCII

B. EBCDIC

C. UNICODE

D. ISO-LATIN-I

Show Answer Answer:-C. UNICODE

Q 60. Which one is the process of defining a method in subclass having same name and type signature as a method in its super class

A. Method hiding

B. Method overloading

C. Method overriding

D. Recursion

Show Answer Answer:-C. Method overriding

Q 61. Which action has the ability to match the request parameter to properties of some name in java bean be specifying ‘*’ for attribute property

A. < jsp : include >

B. < jsp : set Property >

C. < jsp : use Bean >

D. < jsp : param >

Show Answer Answer:-B.

Q 62. Java does not support

A. Hierarchical inheritance

B. Single inheritance

C. Multi-level inheritance

D. Multiple inheritance

Show Answer Answer:-D. Multiple inheritance

Q 63. Which fields enjoy highest degree of protection in Java

A. Public

B. Secure

C. Private

D. Ultra

Show Answer Answer:-C. Private

Q 64. In the Java statement import java.lang.Math; Math is

A. Object

B. Package

C. Class

D. Method

Show Answer Answer:-C. Class

Q 65. In Java Script, if you add a leading zero like “0127” the number system followed is

A. Decimal

B. Octal

C. Binary

D. Hexadecimal

Show Answer Answer:-B. Octal

Q 66. In Java Script, ____ is an object of the target language data type that encloses an object of the source language

A. a wrapper

B. a link

C. a cursor

D. a form

Show Answer Answer:-A. a wrapper

Q 67. Java provides a monitor like concurrency control for ______ synchronization

A. Process

B. TLB

C. Program

D. Threads

Show Answer Answer:-D. Threads

Q 68. In JavaScript which of the following is used to declare variable

A. var

B. dim

C. function

D. const

Show Answer Answer:-A. var

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page