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)
8 views
WrittenTest On CoreJava
written test on Core Java for Testing coding skills
Uploaded by
Pavan Kumar
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save WrittenTest-on-CoreJava For Later
Download
Save
Save WrittenTest-on-CoreJava For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
8 views
WrittenTest On CoreJava
written test on Core Java for Testing coding skills
Uploaded by
Pavan Kumar
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save WrittenTest-on-CoreJava For Later
Carousel Previous
Carousel Next
Save
Save WrittenTest-on-CoreJava For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 9
Search
Fullscreen
Clinical Software Pvt. Lid _Java Trainee Written Test Instructions: 4. Total duration 4 ¥% hr 2. Question1 to 19 has single answer. 3. Question 20 to 30 has multiple answers. 4. Don't write anything on question paper. 1) What is the output of the following? StringBuffer sb1 = new StringBuffer(‘Amit") StringBuffer sb2 = new StringBuffer("Amit’), String ssi = "Amit"; System.out printin(sb1==sb2); ‘System.out.printin(sb1 .equals(sb2)); ‘System.out.printin(sb1 .equals(sst)); ‘System.out printin("Poddar".substring(3)); 2) What is the output of the following? String s1 = new String("amit") String 82 = s1.replace( 'm, ''), s1.concat("Poddar"}; System.out.printin(s1); ‘System.out.printin((s1+82).charAt(5)); famitPoddar 0 a) | ce famit |3) Whats the result of attempting to compile the following code? 4. class OutThing ( 2. class Aninner { 3. public inti 44 5, public static void main(String (] args) { 6. Antnner aninn = new Antnner() 7 aninn.i= 15; 8.) 9} © |the code complies without error [p)[© [ompiter error at tine 3 | © |Compiier error at ine 6 © [Compl error at line 7 | sthod? © Boolean | co ‘bona 5) What will be the output of the following? double dt = -0.5d; ‘System. out printin("Gel for d1” +Math.ceil(d1)): System.out printin(*Floor for di” +Math floor(at)) \eeifordt0 OCS a ») co allfor dt 0 | Floor for dt 4 LPS [Foor for at -1.0 (Ceil for d1 0.0 PG (Cell for d je [Floor for dt -1.0; a Je Floor for d1 1.0; 6) What will be the output of the following Boolean b1 = new Boolean("TRUE"); Boolean b2 = new Boolean("truo"): Boolean 53 = new Boolean("JUNK"), ‘System.out printin(’™+ bt + b2 +53); [ar] ero oor fale |rwetuetase Run time error iiruetruetrue7). Inthe previous question if line 4 is changed to System,out.printin(bt *b2#b3); The output is [a [© [Compite tie error | fe ]© hruetuetaise 8) Look at the following code import java.awt. public class visual extends java applet.Applet { static Button b = new Button("TEST"), public void init() add(b); public static void main(String args{)) { Frame f = new Frame("Visual"); f-setSize(300,300); fadd(oy, fsetVisible(true); } } ‘What will happen if the above code is run as a standalone application? [ a) le [pispiays an empty frame | b) ~ [Displays a frame with a button large “_enough to accomodate its label. plays a frame with a button covering the | lentire frame | 9) What is the value of the following expression? Math.round(Math.random()+2.50001); fae e) | [tis impossible to say. 40) If a java program imports a large number of classes, what is the runtime impact? [ale fale _ here is moderate impact atruntime, | d) | © [There is significant impact at runtime, ‘ner is no impact at runtime [by [© [There is sight impact at rntie,41) What will be the result of attempting to compile and run the following code? abstract class MineBase { abstract void amethod();, static int j public class Mine extends MineBase public static void main(string argv) { int{] ar=new intfS]; for(i=0; i < ar.length;i++) System out printin(arfl) } fale [ole [asequence of os will be printed [Error Mine must be declared abstract by | Enron: aris used before its initialized @) [© |jdexoutorBoundes Error 42) For a class defined inside a method, what rule governs access to the variables of the enclosing method? ied class can access any variable al (= [The cass can only access transient variables [6 [© Ime class can only access static variables ‘ale The class can only access final variables 13) Which of the following lines will compile without waming or error? 114) What is the result of the following operation? ‘system outprintin(4/3); [ule ichar ale lo ale fr15) What will happen if you attempt to compile an Integer ten=new Integer(10); Long nine=new Long(9), System.outprintin(tensnine); inti=t; System.out printin(i+ten); run the following code? ja [e |19 folowed by 20 (>) | {19 followed by 11 ————— — fe [© ror Cannot convert java lang integer | d) | [10 folowed by 4 16) How many objects are created by the code listed below? String s1 = "abo"; 17) What happened when you try to compile the following code and execute the Dolphin application? class Animal (} . class Mammal extends Animal class Cat extends Mammalt) . class Dolphin extends Mammal { public static void main(string args() ( Mammal m = new Catt); Animal a =m; . Dolphin ¢ = (Dolphin)a; } line 6. ‘The code compiles without error 's an exception at line 8. t 18) You need to create a class that will store uniqué ‘The code compiles with no error | a) © fandruns without throwing any |b) | Compiler error at line 6. lexceptons, \ — [Compiler error at ine 7. [a |~ [Compiter error attine 8. ~The code compiles without error | nc code compiles without error and throws an lexception at line 7. fe object elements. You do not need to sort these elements but they must be unique. What interface might be most suitable to meet this need? | | J19) Which of the following will successfully create an instance of the vector class and add an element? a) | new Vector’), ey vaddElement(99); °) le \Vector venew Vector \vaddElement(’99") 20) Which one does not extend java.tang. Number? {integer ‘Boolean ] ie 21) Consider the following ciass definition public class Test extends Base public Testint j) { ) public Test(intj int k) ( supers} } ‘What of the following forms of constructor must exist explicilly in the definition of the Base class? [oF benno” © [a) | feasetit) int nt 0 import java. awi.*; lpackage Mypackage; class Myciass (} pis is a comment * ipackage MyPackage; | | import java.awt.*, class MyClass) 23) What can cause a thread to stop executing? a) Ir [he program exits via a call to exi(0; ‘The priority of another thread is inereased | = [Acallto the stop method of the Thread Jeall to the halt method of the Thread oir air class lass: = —24) Which of the following lines of code will compile without error? | boolean b=true; ] I boolean b2=true; air by i(o==b2) { | | [Sostem out printin'So tne”, | | | | | ei! ja) ir i |System.out printin("OK"); 25) Which of the following methods would be allowed in a subclass of parent? (Choose all permitted methods) Note: EOFException is a subclass of IOException, class Parent { void abede(int i) throws IOException if (10) throw new IOException(); fa |r poi abode(byte 7 \void abede(byte 1 throws Et [ey [Float aedettye tows EOFExcepton a) | [eee jo Fh ptatio vol abee( int) throws IOException | 26) Which of the following methods would be allowed in a subclass of parent? (Choose all permitted methods) Note: EOFException is a subclass of IOException, class Parent void abede(int i) throws IOException { if (10) throw new IOException(); d [a1 [F foisabededint) ~[b) ; ‘oid abedetint) tows Exception °) ri abede(int) throws IOException [a oa abede{int) throws EOFException ey |r Noid abede(int) throws IOException, ) | |Eorexception 727) When you run class C as an application, which of the following lines execute? 1 interface inter) 2. class Al} 3. class Brextends A implements Inter(} 4, class C extends B { 5. public static void main(string ] args) { 6.Aa=new A); 7. B b=new Bi); 8. C cenew Cl); 9. fa instanceof B) 40. System.out.printin("Hello"); 11. if(b instanceof A) 42. System.out printin(’Hello”); 43. if(¢ instanceof C) 14, System.out.printin("Hello”); 15. I{(C instanceof Inter) 16, System.out printin("Hello”);, 17.) 18) 2 \r «tne 10 [a Ir ‘line 12 [ar Fee 16 28) Which of the following code fragments generate compiler error? [a [F pootean too [oy [F[breb=6;charc=b; [phar ot ="a'y shor ser; er [F Jong ton = 1; float jo Ir lat 1 = 2L; tong font a) Ir lan inner class may be declared private. [oir [An inner class defined in a method should ° An inner class defined in a method cai ‘always be anonymous laccess all the method local variables ‘Construction of an inner class may require | ian instance of the outer class.30) Which variable may be correctly referenced at jine 8” 1. public class Outer { 2, public int a 5. private int 4. public void method final int c) { 5. intd = 6 7. class inner { private void iMethod(int e) { 9.) 10.) wir
You might also like
JAVA - MCQ1 - SE - AD Accenture
PDF
No ratings yet
JAVA - MCQ1 - SE - AD Accenture
89 pages
Diagnostic Test Java Programming
PDF
No ratings yet
Diagnostic Test Java Programming
4 pages
A&D Hi Tech CaseAnalysis
PDF
No ratings yet
A&D Hi Tech CaseAnalysis
10 pages
Java 8 (Guía 2) - Examen
PDF
No ratings yet
Java 8 (Guía 2) - Examen
31 pages
Java Programming Moc Test
PDF
No ratings yet
Java Programming Moc Test
31 pages
Core Java Test Questions
PDF
100% (1)
Core Java Test Questions
13 pages
mcq-1 - Core Java
PDF
0% (1)
mcq-1 - Core Java
5 pages
Java Test 7 Aug 2k9
PDF
No ratings yet
Java Test 7 Aug 2k9
19 pages
Java Placement Questions
PDF
No ratings yet
Java Placement Questions
23 pages
Aptitude MCQ For Beginners
PDF
No ratings yet
Aptitude MCQ For Beginners
29 pages
Java Questions 2
PDF
100% (1)
Java Questions 2
11 pages
Oopc Ii Paper 3
PDF
No ratings yet
Oopc Ii Paper 3
23 pages
Java Que Paper
PDF
No ratings yet
Java Que Paper
6 pages
Java MCQ Ans
PDF
No ratings yet
Java MCQ Ans
8 pages
Core Java: Time: 1.30 Hrs
PDF
No ratings yet
Core Java: Time: 1.30 Hrs
9 pages
Ex Amen Java
PDF
No ratings yet
Ex Amen Java
9 pages
Java Test Paper
PDF
No ratings yet
Java Test Paper
8 pages
II-CIA - Java Programming - MCQs - 03.03.2023
PDF
No ratings yet
II-CIA - Java Programming - MCQs - 03.03.2023
17 pages
J 2
PDF
No ratings yet
J 2
5 pages
Auto Cad Question
PDF
No ratings yet
Auto Cad Question
45 pages
Examen1Z0 815
PDF
No ratings yet
Examen1Z0 815
65 pages
Name - Hrythm R.No. - 1815689: Java MCQ Test - 25ques Coding Questions-2
PDF
No ratings yet
Name - Hrythm R.No. - 1815689: Java MCQ Test - 25ques Coding Questions-2
16 pages
Java CTS Dumps 5
PDF
No ratings yet
Java CTS Dumps 5
30 pages
Select All Right Answers. A. Class Animal (: Abstract Void Growl ) Abstract Animal (Abstract Void Growl )
PDF
No ratings yet
Select All Right Answers. A. Class Animal (: Abstract Void Growl ) Abstract Animal (Abstract Void Growl )
27 pages
Java Examination (Include Answer)
PDF
No ratings yet
Java Examination (Include Answer)
14 pages
Java Mock Tests For SCJP
PDF
100% (4)
Java Mock Tests For SCJP
27 pages
Java
PDF
No ratings yet
Java
4 pages
Test 2
PDF
No ratings yet
Test 2
5 pages
MCQ's
PDF
No ratings yet
MCQ's
10 pages
Java Quiz
PDF
No ratings yet
Java Quiz
39 pages
Mock Exam 3 Answers
PDF
No ratings yet
Mock Exam 3 Answers
25 pages
Answer: A Explanation:Here We Will Use Treeset As It Will Sort Also All Items - Because We Want Output in Sorted Form
PDF
No ratings yet
Answer: A Explanation:Here We Will Use Treeset As It Will Sort Also All Items - Because We Want Output in Sorted Form
11 pages
Test Q
PDF
No ratings yet
Test Q
25 pages
Question Bank For J2SE
PDF
No ratings yet
Question Bank For J2SE
3 pages
Core Java (25 Minutes) : Centre For Development of Advanced Computing
PDF
No ratings yet
Core Java (25 Minutes) : Centre For Development of Advanced Computing
3 pages
9 The@override
PDF
No ratings yet
9 The@override
44 pages
Java Objective Questions
PDF
No ratings yet
Java Objective Questions
12 pages
Test 1
PDF
No ratings yet
Test 1
31 pages
Java Mock3
PDF
No ratings yet
Java Mock3
19 pages
11
PDF
No ratings yet
11
13 pages
JAVA QUESTIONS 1 (24.1.22) : A. 1, 2, 4 B. 2, 4, 5 C. 2, 3, 4 D. All Are Correct. Answer: Option A
PDF
No ratings yet
JAVA QUESTIONS 1 (24.1.22) : A. 1, 2, 4 B. 2, 4, 5 C. 2, 3, 4 D. All Are Correct. Answer: Option A
9 pages
Core Java Ques
PDF
No ratings yet
Core Java Ques
39 pages
Set 3
PDF
No ratings yet
Set 3
7 pages
RCJ 2
PDF
No ratings yet
RCJ 2
18 pages
MOCK exam 1
PDF
No ratings yet
MOCK exam 1
12 pages
Sample Paper
PDF
No ratings yet
Sample Paper
9 pages
Exercices - Certification Oracle 1Z0-803
PDF
No ratings yet
Exercices - Certification Oracle 1Z0-803
147 pages
Practice Core Java and Advanced Java MCQs
PDF
No ratings yet
Practice Core Java and Advanced Java MCQs
13 pages
Java MockExam - 8
PDF
No ratings yet
Java MockExam - 8
23 pages
Java Questions 2: A. B. C. D
PDF
No ratings yet
Java Questions 2: A. B. C. D
10 pages
Questions
PDF
No ratings yet
Questions
36 pages
MCQ Java
PDF
No ratings yet
MCQ Java
10 pages
Progress Test 2 - Key Spring20
PDF
No ratings yet
Progress Test 2 - Key Spring20
9 pages
Exam 1 Questions
PDF
No ratings yet
Exam 1 Questions
10 pages
Java Questions
PDF
No ratings yet
Java Questions
7 pages
Java SE 7 Programmer II - Sample Questions
PDF
No ratings yet
Java SE 7 Programmer II - Sample Questions
7 pages
FNT Software Solutions Placement Papers
PDF
No ratings yet
FNT Software Solutions Placement Papers
8 pages
SQL Injection
PDF
No ratings yet
SQL Injection
1 page
Teradyne Corporation: The Jaguar Project: (Submitted Towards Case Analysis Under Project Management)
PDF
No ratings yet
Teradyne Corporation: The Jaguar Project: (Submitted Towards Case Analysis Under Project Management)
6 pages
Manchester United Soccer
PDF
100% (1)
Manchester United Soccer
5 pages
Schmidt Co
PDF
No ratings yet
Schmidt Co
13 pages