0% found this document useful (0 votes)
22 views

Java-Programming Solved MCQs (Set-3)

The document contains 75 multiple choice questions about Java programming topics such as primitive data types, classes, inheritance, interfaces, packages, strings, exceptions and more. The questions cover basic to advanced concepts of Java.

Uploaded by

e1513152528
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Java-Programming Solved MCQs (Set-3)

The document contains 75 multiple choice questions about Java programming topics such as primitive data types, classes, inheritance, interfaces, packages, strings, exceptions and more. The questions cover basic to advanced concepts of Java.

Uploaded by

e1513152528
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Java Programming MCQs [set-3]

51. A primitive data type can be passed as an argument into a method

A. By value

B. by reference

C. both a & b

D. none of these
o m
.c
Answer: A
te
a
specifier is used for it? q M
52. Which of these is used as default for a member of a class if no access

c
A. private M
B. public

C. public, within its own package

D. protected

Answer: C

53. Which of these keywords is used to refer to member of base class from
a sub class?

A. upper

B. super

C. this

D. None of the mentioned

Answer: B

54. Which of these is correct way of inheriting class A by class B?

A. class B + class A {}

Download more at McqMate.com


B. class B inherits class A {}

C. class B extends A {}

D. class B extends class A {}

Answer: C

55. Which of the following are true about interfaces.

A. Methods declared in interfaces are implicitly private.

o m
B. Variables declared in interfaces are implicitly public, static, and final.

.c
C. An interface contains any number of method definitions.

te
a
D. The keyword implements indicate that an interface inherits from another.

Answer: B
q M
c
M
56. Which of these keywords is used to define interfaces in Java?

A. interface

B. Interface

C. intf

D. implements

Answer: A

57. Which of these can be used to fully abstract a class from its
implementation?

A. Objects

B. Packages

C. Interfaces d) None of the Mentione

Answer: C

58. Which of these access specifiers can be used for an interface?

A. Public

Download more at McqMate.com


B. Protected

C. private

D. All of the mentioned

Answer: A

59. Which of these keywords is used by a class to use an interface defined


previously?

A. import

o m
B. Import
.c
C. implements
te
a
D. Implements

q M
Answer: C
c
M
60. Which of the following is correct way of implementing an interface
salary by class manager?

A. class Manager extends salary {}

B. class Manager implements salary {}

C. class Manager imports salary {} d) None of the mentione

Answer: B

61. The keyword used to create a package is

A. import

B. package

C. classpath

D. public

Answer: B

Download more at McqMate.com


62. The modifier which specifies that the member can only be accessed in
its own class is

A. public

B. private

C. protected

D. none

Answer: B

o m
.c
63. Which of the following package stores all the standard java classes? a)
jav
te
a
A. lang
q M
B. java c
C. java.util M
D. java.packages

Answer: A

64. Which of these is a mechanism for naming and visibility control of a


class and its content?

A. Object

B. Packages

C. Interfaces d) None of the Mentione

Answer: B

65. Which of this access specifies can be used for a class so that its
objects can be created by a different class in another package?

A. Public

B. Protected

C. No Modifier

Download more at McqMate.com


D. All of the mentioned

Answer: A

66. Which of the following is correct way of importing an entire package


‘pkg’?

A. import pkg.

B. Import pkg.

C. import pkg.*

o m
D. Import pkg.*
.c
Answer: C
te
a
q M
67. Which of the following is incorrect statement about packages?
c
M
A. Package defines a namespace in which classes are stored.

B. A package can contain other package within it.

C. Java uses file system directories to store packages.

D. A package can be renamed without renaming the directory in which the classes are stored.

Answer: D

68. Which of these method of class String is used to extract a single


character from a String object?

A. CHARAT()

B. chatat()

C. charAt()

D. ChatAt()

Answer: C

69. Which of these method of class String is used to obtain length of


String object?

Download more at McqMate.com


A. get()

B. Sizeof()

C. lengthof()

D. length()

Answer: D

70. Which of these keywords is not a part of exception handling?

A. try
o m
B. finally
.c
te
C. thrown
a
D. catch
q M
Answer: C
c
M
71. The code within the ----------- block will always be executed whether or
not an exception is thrown.

A. try..catch

B. finally

C. throw

D. throws

Answer: B

72. Which of these keywords must be used to monitor for exceptions?

A. try..catch

B. finally

C. throw

D. throws

Answer: A

Download more at McqMate.com


73. Which of these keywords is used to manually throw an exception?

A. try

B. finally

C. throw

D. catch

Answer: C

o m
74. Which of these classes is related to all the exceptions that can be
caught by using catch? .c
te
A. Error a
B. Exception
q M
c
C. None of these

D. a & b
M
Answer: B

75. Which of these classes is related to all the exceptions that cannot be
caught?

A. Error

B. Exception

C. None of these

D. a & b

Answer: A

Download more at McqMate.com


Take Quick Mock/Practice test on this topic HERE

For Discussion / Reporting / Correction of any MCQ please visit discussion page by clicking on
'answer' of respective MCQ.

McqMate is also available on

PlayStore

o m
.c
te
a
q M
c
M

Download more at McqMate.com

You might also like