Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
217 views
Java MCQ
Uploaded by
Yash Koli
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save java mcq For Later
Download
Save
Save java mcq For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
217 views
Java MCQ
Uploaded by
Yash Koli
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save java mcq For Later
Carousel Previous
Carousel Next
Save
Save java mcq For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 18
Search
Fullscreen
‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint hitps:wwjavatpoint.convava-meq anesniroz0at, 18:5 Java MCQ (Multiple Choice Questions) ~Javatpint Java Multiple Choice Questions 1) Which ofthe following option leads to the portability and security of Java? a. Bytecode is executed by JVM b. The applet makes the Java code secure and portable ¢. Use of exception handling 4d, Dynamic binding between objects Show Answer Workspace 2) Which of the following is not a Java features? a. Dynamic b. Architecture Neutral €. Use of pointers 4, Object-oriented Show Answer Workspace 3) What should be the execution order, if a class has a method, static block, instance block, and constructor, as shown below? public class First_C { public void myMethodg, { System.out printin(’Method’); ) ‘ System.out.printin(” Instance Block"); ) public void First_CO ‘ System.out printin(’Constructor "); ) static ( System out printin(‘static bloc ) public static void main(Stringl] args) ( First_C ¢ = new First_CO; cFirst_CO; SCROLL TO TOP tps: javatpoint.convava-meq aneswit0r2021, 19:54 Java MCO (Multiple Choice Questions) -Javatpoint ) ) a. Instance block, method, static block, and constructor b. Method, constructor, instance block, and static block «. Static block, method, instance block, and constructor . Static block, instance block, constructor, and method Show Answor Workspace 4) What will be the output of the following program? public class MyFirst { public static void main(Stringl] args) ( Myfirst obj = new MyFirst(n); int ¢ public MyFirst(int rm) ( System outprintin(a + °," +b +", ) I instance Block ‘ b= 30; n= 20; ) 17 Static Block static SCROLL TO TOP hitps:wwjavatpointconvava-meq ane‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint ) a, 10,5, 0, 20,0 b. 10, 30, 20 60, 5,0, 20 4. 60, 30,0, 20,0 Show Answor Workspace 5) The \u0021 article referred to as a 1, Unicode escape sequence b. Octal escape Hexadecimal 4d. Line feed Show Answor Workspace 6) _is used to find and fix bugs in the Java programs. a. JVM b. JRE «JDK 4. JDB Show Answor Workspace 7) Which of the following is a valid declaration of a char? a. char ch b. char ca = ‘tea’ char er = \u0223; 4. char ce = ‘tea’ Show Answer Workspace £8) What is the return type of the hashCode() method in the Object class? a, Object b. int « long 4. void Workspace hitps:wwjavatpoint.convava-meq ana‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint 9) Which of the following is a valid long literal? a, ABH8097 b. 990023 904423 <4. Oxnf029L Show Answor Workspace 10) What does the expression float a = 35 / 0 return? ao b. Nota Number «Infinity dd. Run time exception Show Answor Workspace 11) Evaluate the following Java expression, if x=3, y=5, and z=10: tezty-ye zene aad b. 23 «20 6.25 Show Answer Workspace 12) What will be the output of the following program? public class Test ( public static void main(String] args) ( int count Tt hitps:wwjavatpoint.comvava-meq sie‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint ++count > Lend while )»—/fend main a, 15 times ** b. 15 times +++++ Btimes *** and 7 times +++++ 4, Both will print only once Show Answer Workspace 13) Which of the following tool is used to generate API documentation in HTML format from doc comments in source code? a. javap tool b. javaw command «Javadoc tool 4. javah command Show Answer Workspace 114) Which of the following creates a List of 3 visible items and multiple selections abled? a, new List(false, 3) b. new List, true) new List(true, 3) . new List(3, false) Show Answer Workspace 15) Which of the following for loop declaration is nat valid? a. for (int i = 99;1 >= 0;1/9) b. for (inti = Ti Thit=7) « for (inti = 20;i >= 2; i) 4. for (inti = 2;1 <= 20;i = 2°) Show Answer Workspace 16) Which method of the Class class is used to determine the name of a class represented by the class object as a String? hitps:wwjavatpoint.convava-meq ane‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint a. getClass) b. internd « getName 4. toStringd) Show Answer Workspace 17) In which process, a local variable has the same name as one of the instance variables? a. Serialization b. Variable Shadowing Abstraction , Multi-threading Show Answer Workspace 18) Which of the following is true about the anonymous inner class? a. Ithas only methods b. Objects can't be created Ithas a fixed class name 4, Ithas no class name ‘Show Answer Workspace 19) Which package contains the Random class? a. javautil package b. javaltang package hitps:wwjavatpoint.convava-meq 78‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint 4. java.io package Show Answer Workspace 20) What do you mean by nameless objects? a. An object created by using the new keyword. b. An object of a superclass created in the subclass. ¢. An object without having any name but having a reference. 4. An object that has no reference. Show Answer Workspace 21) An interface with no fields or methods is known as a a, Runnable Interface b. Marker Interface . Abstract Interface 4d, CharSequence Interface ‘Show Answer Workspace 22) Which of the following is an immediate subclass of the Panel class? 1 Applet class b. Window class «Frame class 4. Dialog class Show Answor Workspace 23) Which option is false about the final keyword? a. A final method cannot be overridden in its subclasses. b. A final class cannot be extended, A final class cannot extend other classes. 4. A final method can be inherited. Show Answor Workspace 24) Which of these classes are the direct subclasses of the Throwable class? a, RuntimeException and Error class b. Exception and VirtualMachineError class tion class hitps:wwjavatpoint.convava-meq ana‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint 4, IOException and VirtualMachine€rror class Show Answer Workspace 25) What do you mean by chained exceptions in Java? a. Exceptions occurred by the VirtualMachine€rror b. An exception caused by other exceptions ¢. Exceptions occur in chains with discarding the debugging information 4d. None of the above Show Answer Workspace 26) In which memory a String is stored, when we create a string using new operator? a, Stack b. String memory c Heap memory 4, Random storage space Show Answer Workspace 27) What is the use of the intern) method? a, Itretums the existing string from memory b. It creates a new string in the database ¢. It modifies the existing string in the database 4d. None of the above Show Answor Workspace 28) Which of the following is a marker interface? a, Runnable interface hitps:wwjavatpoint.convava-meq one‘swit012021, 19:54 Java MCO (Multiple Choice Questions) -Javatpoint © Readable interface 4. Result interface Show Answor Workspace 29) Which of the following is a reserved keyword in Java? a. object b. strietfp system Show Answer Workspace 30) Which keyword is used for accessing the features of a package? a. package b. import c. extends, export Show Answer Workspace 31) In java, jar stands for, a. Java Archive Runner b, Java Application Resource . Java Application Runner 4d. None of the above Show Answer Workspace 32) What willbe the output of the following program? public class Test2 ( public static void main(Stringl] args) ( StringBuffer st = new StringBuffer(’Complete’); s1.setCharAt(1,"i); si setCharAt(7,'d) Systemout.printin(st); hitps:wwjavatpoint.convava-meq sone‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint « Cimpletd 4. Coipletd Show Answer Workspace 33) Which of the following is false? 1 The rtjar stands for the runtime jar b. Itis an optional jar file It contains all the compiled class files 4. All the classes available in rtjar is known to the JVM Show Answer Workspace 34) What ist fe use of \w in regex? 1, Used for a whitespace character b. Used for a non-whitespace character Used for a word character 4. Used for a non-word character Show Answer Workspace 35) Which of the given methods are of Object class? a. notify), wait( long msecs ), and synchronized) b. wait( long msecs ), interrupt0, and notifyAll. €. notify, notifyAllO, and wait 4d, sleep( long msecs ), waitd, and notifyo Show Answer Workspace 36) Given that Student is a class, how many reference variables and objects are created by the following code? studentName = new Student0; Student stud class = new Student0; 1, Three reference variables and two objects are created. b. Two reference variables and two objects are created. One reference variable and two objects are created, 4. Three reference variables and three objects are created Workspace hitps:wwjavatpoint.convava-meq anne‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint 37) Which of the following is a valid synta synchronize the HashMap? a, Map m = hashMap synchronizeMap0); b. HashMap map =hashMapsynchronizeMap0; Map m1 = Collections.synchronizedMap(hashMap); d. Map m2 = Collection synchronizeMap(hashMap); Show Answor Workspace 38) Given, ArrayList list = new ArrayList0: What is the initial quantity of the ArrayList list? 4. 100 Show Answer Workspace 38) Which of the following is a mutable class in java? a. javalang String b. javalang.Byte « javalang Short 4. java.tang StringBuilder Show Answor Workspace 40) What will be the output of the following program? abstract class MyFirstClass ( abstract num (int a, int b) ( } a. No error b. Method is not defined properly &. Constructor is not defined properly 4. Extra parentheses - Workspace hitps:wwjavatpoint.convava-meq vane‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint 41) What is meant by the classes and objects that dependents on each other? a, Tight Coupling b. Cohesion «& Loose Coupling 4d. None of the above Show Answor Workspace 42) Given, values|} = (1.2.3: for(int i=O;i< Y; ++i) 5,6,7,8,9,10}; System.out printin(values(i); Find the value of value(i]? a. 10 ba <5 4d. None of the above Show Answor Workspace 43) Which of the following code segment would execute the stored procedure “getPassword()" located in a database server? a, CallableStatement cs = connection prepareCall("{call getPassword()"); cs.executeQuery0) b, CallabledStatement callable = conn prepareCall((call getPassword()"); callable executeUpdated; ¢. CallableStatement cab = con,prepareCall("{call getPassword()"); cabexecuteQuery(; 4, Callablestatement cstate = connect prepareCall("(call getpassword()"); estate executeQuery(); Show Answer Workspace 44) How many threads can be executed at a time? a. Only one thread b. Multiple threads . Only main (main method) thread . Two threads Workspace hitps:wwjavatpoint.convava-meq sane‘swit012021, 19:54 Java MCO (Multiple Choice ions) -Javatpaint 45) If three threads trying to share a single object at the same time, which condition will arse in this scenario? a, Time-Lapse b. Critical situation Race condition 4. Recursion Show Answor Workspace 46) Ifa thread goes to sleep 2, It releases all the locks it has. b. It does not release any locks It releases half ofits locks. 4d, It releases all of its lock except one. Show Answor Workspace 47) Which of the following modifiers can be used for a variable so that it can be accessed by any thread or a part of a program? a. global b. transient volatile . default ‘Show Answer Workspace 48) What is the result of the following program? public static synchronized void main(Stringl] args) throws Interruptedexception ( Thread f = new Thread); fstart0; System out print f.wait(1000); System.out,print( It prints A and B with a 1000 seconds delay between them b. Itonly prints A and exits It only prints B and exits 4. Awill be printed, and then an exception is thrown. hitps:wwjavatpoint.convava-meq sais‘w1s012021, 19:86 Java MCO (Multiple Choice Questions) -Javatpoint Show Answer Workspace 49) In character stream I/O, a single read/write operation performs a. Two bytes read/write at a time. b, Eight bytes read/write at a time, One byte read/write at a time. 4d. Five bytes read/ write at a time. ‘Show Answer Workspace 50) What is the default encoding for an OutputstreamWriter? a, UTE-B b, Default encoding of the host platform UTF-12 4d. None of the above ‘Show Answer Workspace (2:Younbe For Videos Join Our Youtube Channel: Join Now Feedback © Send your Feedback to feedback @javatpoint.com Please Share hitps:wwjavatpoint.convava-meq 198‘swit0r2021, 19:54 Learn Latest Tutorials #Splunk tutorial ——(YYSPSS tutorial ig Swagger AT-SQL tutorial |p Tumbir tutorial ‘Splunk ‘SPSS tutorial Transact-SQL Tumblr Swagger React tworial ——gfRegex tutorial Reinforcement giR Programming giRxIS tutorial — owes earning tutorial ‘torial ees Reinforcement R Programming Learning ie. React Native Python Design # Python Pillow ls) Python Turtle (piKeras tutorial tutorial Patterns tetoral tutorial ons React Native Python Design Python Pillow Python Tule Patems Preparation Logical ZNerbal Ability — 6) _ Interview DLL TO TOP ' . Reasoning Verbal Abity Questions hitps:wwjavatpoint.comvava-meq rene‘swi1012021, 19:54 Java MCO (Multiple Choice Questions) -Javatpoint Reasoning Trending Technologies 2 Anifical WAWS Tutorial ig _ Selenium Ineligece saws tutorial Selenium Ail Intligene BE Reacts. Data Science g Angular 7 Tutorial Tutorial, Tutorial Reacts Data Science Angular? #2. Machine gi DevOps Tearing Tutorial Tutorial, Machine Leming Devops B.Tech / MCA DBMS torial —g2Data Structures {DAA ttorial aus tutorial DAs Data Structures 2 Compiler 2 Computer - Discrete Design tutorial “Organization and” Mathematics connor Dosen ‘Architecture Tutorial Computer Discrete ROLL TO TOP Orgatizaton Mathematics hitps:wnjavatpoint.conijava-meq Interview Questions (2 Cloud Computing tutorial Cloud Computing i) Blockchain Tutorial Blockehain U2 Operating System tutorial Operating Systems \eiEthical Hacking Tutorial Ethieal Hacking 2 Company Interview Questions. Company Questions |Z Hadoop tutorial Hisdoop (Git Tutorial Git 2 Computer ‘Network tutorial Computer Nework 2 Computer Graphics Tutorial Computer Graphics we.‘swit012021, 19:54 2 Software Engincering ‘Tutorial Software Engineering ACH tutorial oH 2 Control Systems tutorial Control System ROLL TO TOP. hitps:wwnjavatpoint.comjava-meq (#htm! tutorial Web Technology #3ava tutorial Java a) Data Mining Tutorial ‘Data Mining Java MCO (Multiple Choice Questions) -Javatpoint ACyberScourty Ig Awtomata gC Language ‘atrial Tatorial tuforl Cyber Security ‘Automata C Programming A oNe Python torial — 2 _Listof Framework Programs mews Pyton Programs Net Data ‘Warehouse Tutorial Data Warehouse 1818
You might also like
Solved Java
PDF
No ratings yet
Solved Java
28 pages
MCQ_JAVA_Answer
PDF
No ratings yet
MCQ_JAVA_Answer
11 pages
Java
PDF
No ratings yet
Java
10 pages
Java QB
PDF
No ratings yet
Java QB
40 pages
Java MCQ
PDF
No ratings yet
Java MCQ
6 pages
CoreJava QuestionPaper
PDF
No ratings yet
CoreJava QuestionPaper
15 pages
java dums(1)-1
PDF
No ratings yet
java dums(1)-1
61 pages
Java Question and Answer
PDF
No ratings yet
Java Question and Answer
15 pages
JAVA MCQ-CSA0917-word format
PDF
No ratings yet
JAVA MCQ-CSA0917-word format
6 pages
Oops
PDF
No ratings yet
Oops
42 pages
Solution Manual - Electronic Devices and Circuit Theory 10th Edition
PDF
No ratings yet
Solution Manual - Electronic Devices and Circuit Theory 10th Edition
13 pages
MCQ
PDF
No ratings yet
MCQ
11 pages
all jav programs of string
PDF
No ratings yet
all jav programs of string
9 pages
Java Fundamentals: X (X ) ? (Y+x) : (Y-X)
PDF
No ratings yet
Java Fundamentals: X (X ) ? (Y+x) : (Y-X)
19 pages
Java Multiple Choice Questions and Answers
PDF
No ratings yet
Java Multiple Choice Questions and Answers
34 pages
OOPS Java 50 Objective Questions Mid-1-2024-25
PDF
No ratings yet
OOPS Java 50 Objective Questions Mid-1-2024-25
8 pages
EXAM2QUESTIONS
PDF
No ratings yet
EXAM2QUESTIONS
7 pages
JAVA MCQ QUESTIONS for Quizzes
PDF
No ratings yet
JAVA MCQ QUESTIONS for Quizzes
47 pages
Java Programming MCQ QB: Unit 1: Basic Syntactical Construct in Java
PDF
No ratings yet
Java Programming MCQ QB: Unit 1: Basic Syntactical Construct in Java
51 pages
PRO192
PDF
No ratings yet
PRO192
218 pages
Notepad
PDF
No ratings yet
Notepad
5 pages
Java MCQ
PDF
No ratings yet
Java MCQ
6 pages
Object Oriented Programming and Java (MC221) January 2006
PDF
No ratings yet
Object Oriented Programming and Java (MC221) January 2006
18 pages
Comprog 2 Finals
PDF
0% (1)
Comprog 2 Finals
12 pages
Top 40 Java Interview Questions and Answers
PDF
No ratings yet
Top 40 Java Interview Questions and Answers
16 pages
Object Oriented Programming and Java (MC221) April 2006
PDF
No ratings yet
Object Oriented Programming and Java (MC221) April 2006
22 pages
Java
PDF
No ratings yet
Java
43 pages
java ôn tập
PDF
No ratings yet
java ôn tập
92 pages
java notes
PDF
No ratings yet
java notes
60 pages
UNIT I JAVA
PDF
No ratings yet
UNIT I JAVA
8 pages
Oops CS8392 MCQ
PDF
No ratings yet
Oops CS8392 MCQ
37 pages
Objective Questions
PDF
No ratings yet
Objective Questions
27 pages
Oops
PDF
No ratings yet
Oops
10 pages
Java Career Ride
PDF
No ratings yet
Java Career Ride
14 pages
Choice A Choice B Choice C Choice D
PDF
No ratings yet
Choice A Choice B Choice C Choice D
15 pages
oop MCQ
PDF
No ratings yet
oop MCQ
12 pages
Java Programming456 QB
PDF
No ratings yet
Java Programming456 QB
85 pages
Java Summer 23
PDF
No ratings yet
Java Summer 23
21 pages
OOP LABQ1 and 2
PDF
No ratings yet
OOP LABQ1 and 2
12 pages
Java MCQ
PDF
No ratings yet
Java MCQ
18 pages
Java Programming 9th Edition Joyce Farrell Test Bank instant download
PDF
100% (2)
Java Programming 9th Edition Joyce Farrell Test Bank instant download
48 pages
MCQ's Based on Java
PDF
No ratings yet
MCQ's Based on Java
18 pages
AnswerkeyComputerProgramming PDF
PDF
No ratings yet
AnswerkeyComputerProgramming PDF
5 pages
Maulana Abl:.Il - Kalam Azad University of Technology, West Bengal
PDF
No ratings yet
Maulana Abl:.Il - Kalam Azad University of Technology, West Bengal
2 pages
Java Examination Paper2 Question
PDF
No ratings yet
Java Examination Paper2 Question
9 pages
Model Question Paper of Java Programming (1)
PDF
No ratings yet
Model Question Paper of Java Programming (1)
4 pages
Java MCQ Questions
PDF
No ratings yet
Java MCQ Questions
11 pages
Programming in Java
PDF
No ratings yet
Programming in Java
7 pages
SXCS RE Computer 2024
PDF
No ratings yet
SXCS RE Computer 2024
4 pages
Core Java Basic Level I Question Bank
PDF
No ratings yet
Core Java Basic Level I Question Bank
22 pages
OOp Prelim Exam
PDF
No ratings yet
OOp Prelim Exam
33 pages
Example Questions for CBT Exam
PDF
No ratings yet
Example Questions for CBT Exam
32 pages
Java Programming 9th Edition Joyce Farrell Test Bankpdf download
PDF
100% (4)
Java Programming 9th Edition Joyce Farrell Test Bankpdf download
44 pages
Java Skill Test Question/answer
PDF
No ratings yet
Java Skill Test Question/answer
6 pages
Pre-Midsem Quiz Solution
PDF
No ratings yet
Pre-Midsem Quiz Solution
7 pages
Opps
PDF
No ratings yet
Opps
7 pages
Exercises
PDF
100% (1)
Exercises
15 pages