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)
531 views
10 pages
Abstraction, Package - Exception Handling PDF
Uploaded by
Naviz Joyl S
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
Save
Save 3. Abstraction,Package_Exception Handling.pdf For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
531 views
10 pages
Abstraction, Package - Exception Handling PDF
Uploaded by
Naviz Joyl S
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
Carousel Previous
Carousel Next
Download
Save
Save 3. Abstraction,Package_Exception Handling.pdf For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save 3. Abstraction,Package_Exception Handling.pdf For Later
You are on page 1
/ 10
Search
Fullscreen
REGISTRATION | exam Welcome | Logout | RePoRTS | PROFILE Report Details 2 3 Attended Question and their Answers Test vest Test vest Est Est Est Est Est vest vest vest vest Name Exam Type Assessment Assessmen! Assessment Assessment Assessment Assessment Assosement Assossmy Assessment Assessment Assessment Kr MCO-Testt-030218 Kir jove-n21218 kreMca.022418 kIrMoa.031716 KiTsMca-rt-052218 kreMca.052418 KIT-APEH- 260518 KIT-JUNIT-2605°8 KIT-JUNIT2-2005°8 KITAGESTS-200518 KITFULL-300518 KITAVGe-300518 KIT-S1_3105%8 Questo 1s the following declaration for interface Bendable correct and free of compilation error? abstract interface Bendable { // line 1 ‘final. ine x = 2009 void methodi() j // line 5 public static class angle () // Tine 6 options: Rives, this is a correct and free Bit, compilation enror at Line 2 Cito, compilation enror at Line 3 Dito, compilation enror at Line § E.tio, compilation error at Line 6 if Tine’ ff error declaration abstract should be removed X should be declared public final nethod methodi() should be declared public abstract Exam Date oanaz018 27022018 2ain2i20%8 srosi2018 2ainsi20%8 2410512018 26i0si2018 2610512018 2ainsi20%8 2ainsi2016 s0insi2018 suinsi2o18 suinsizo18 Can't declare a clase inside an interface |Will the following code compile correctly? abstract class AirPlane { y abstract void f1y()5 void land() { // Line s systen.out.print("Landing..") ¥ class Airjet extends Airplane { Airdet() { super()3 // line 14 t void fly) { System.out.print("Flying. Yes, it will compile with no errors No, because at line 5 method land() must be abstract since clase AirPlane is abstract No, because class AirJet must override method land() No, because at line 14 AirJet constructor is calling the super() nile AirPlane has no constructor defined ps 72.65.17 408 PacemenCarmonAcion spoarcanlingtnatoneoraneack tn ‘tal Marks oo 0 oo oo oo oo oo oo oo oo oo oo oo Mark View Questionaire View Questionaire View Questionaire View Questionaire View Questionaire View Questionaive View Questonaive View Questionaire View Questionaire View Questionaire View Questionaire View Questionaire View Questionaire student TOTAL SCORE 10 e Mark cored 110 oo 10 10ip... 17408 Pcementerwroctonctprensat ‘he fotlaing cade contine sconllatin error what can be cone to fix this ever Independently? Bieriet dot titsiane ¢//2ise satrect old A190) I line 2 vote ned Syren. ou. print Lanne." > huss atroet eens atreane ( // Le 10 esto steer 11 Mine 3 > toss nyo ¢ Shen ot. prnt Pyne "35 > Deseret votd ant) 1/ tin 20 tract from Line 20 and a bd to pth Lad) ard 8. Renove abstract fron Line 20 ond edt body to method Lard() or Declare clare sire sr abetract to #8 ine 30 c Mich of the following ¢ true? fnsvers: a ae 3 class 1s declared abstract , st must contain at least one abstract method 2. Ifa class 45 declared abstract 5 oll'Ies methods must be abstract, 3. —Aimethod can either be Final of dbstract 4) Gra natnod Ss abstract then Sts clace must be declared abstract 5: an abstract method has no body and ends with « semicolon options: Ae aLL ane correct 8. All are not correct €. ALL ane correct except 2 B.A are not correct except 2 D Which of the following variables is incorrectly declared? public abstract interface Bouncable t 5 int a = 05 public int b = 15 public static int c= 2 public static transient int d = 3; public final int e = 3; public static final int f + options: A a B. b Ics c D. d E. e F. f c Three of the methods are incorrectly declared, which are they? public abstract class Tester { public void test1()3 public final void test2() {33 public static void test3() {}3 public abstract static void testa(); public abstract final void test5(); t Please choose only one answer: testl , test2 and testa test2 , testa and tests test1 , testa and testS None of these > 10 10 00 00Considering the following declaration fan interface Convertable, wich oF the Falloning code public interface Convartabie { Ine convereTatnt(); chan convereTocnar(); Pease choose all the answers that apply! 1. class bight taplements Convertable { public chan convertTothar() { retuon @ pubic ane converctorne() Feu 6} y 2 abstract class Oigit implements Convertable { Int canverttotnt() 3 char convoretachar; 3. abstract class Digit inplenents Convertable { public int convertToine() {retum es) 4, sbsteact class Digit Anplenents Convertable { public int convertTorne() {return @; + ‘han convertracnar()3, y 5. class Digit inplenents Convertable { int convertTotne() {return O5 ) chan convereTothar() { retumm O } 5. Antenface Roundable extends Convertable { ine ronan); } Options Ao 4,3 and 5 are Correct 5. 1)2 and 6 are Cormect oe AGF aT AEN Zt. public abstract class Digit { public abstract void print(); } Me. public class Digit { public abstract void print(); } a. public abstract class Digit { public abstract void print(){} } a public abstract class Digit { public void print();} I public class Digit { public void print(){};} AL 182 oo : pam ey ; Se ya wee ; i = mark m2() "public™ 7 ps 72.65.17 408 PacemenCarmonAcion spoarcanlingtnatoneoraneack tn 10 oo 00" 2 What is the correct output? interface Father { public void go(); } interface Mother { public void go(); } class Tester implements Father, Mother { // line 1 @override public void go(){ // line 2 system. out.print1n("Child") ; } public static void main(String args[]) { new Tester().go(); // line 3 } } Options: A. Compilation error in line 1 B. compliation error in line 2 c. child D. compilation error in line 3 c 10 F oo Wihet is the expected output? import java.io.10Exception; clase Father { public Father() throws IOException { Systen.out.print ("Father"); throw new IO0Exception(); + > class Son extends Father { public Son() throws IOException System.out print ("son"); ) 3 public class Tester { public static void main(string[] args) ( try new Son(); } catch (IOException e) { System.out.print("Inside catch"); ) > > options: AR. Compile error, constructors can't throw Exceptions 8. —-Fatherson C.FatherInside catch D. Father, then an IOException is thrown =z Son Fl Sontnside catch c 10 8 oo ps 72.65.17 408 PacemenCarmonAcion spoarcanlingtnatoneoraneack tn a0a “ 6 ‘ihat iz the expected output of compiling and running this code? class Father ( public Father() throws Runtineexception { Systom.out print("rather"); ‘throw new Runtimetxception(); y » cass Son extends Father { public Son() throws Runtimakxception { System.out .print("Son"); y public class Tester { public static vold main(stringl] ares) { rrew Son(); // line 17 y ? Options a compile error, an import to java.Lang.Runtinetxception is required 8 Father uill be printed then @ RuntineException would be thrown ic Conpile error at line 17, new Son() should be within a try/eatch block 5 ‘Son e Senather F Fatherson ee e 10 8 10 Bak fe topcted rept of cnplng ond morn the flowing es clase Airplane ible Adreuane()_ syetam out. prine(AePLane"); , clase Aitaet extends Airplane { obite alraee() trone Toeeception ( tne ‘on non TobxceptHon()5 ) catch (Goeneaption «) { ‘yaten.outpetne("TobAception He throw in Aire"); . pubtic clase Tester { plbide statis vols main(String sree{]) ( tt ow air3ee0)5 2 eaten €Iobseepton e) { “Syeeomoutsprint("2obscoption 4s thrown sn Testar")s > > options 2. skSteiSnezoescopeson 2 envoy £9 Testers will be pranees 5. canpiiacion ercor Oc e 10 A oo [lat fs the expected ovtaut of consing and runing te flora code? Inport Java.t0.r08xception; lass alrpiane ( PUblie AisPLene() throws ToExceptéon, muntimeéxception { ‘system. ovt.printincoaurbLane®) 5 » d lass siraet extends AiePlane { } // Line 7 public clase Soster (| publi Static vols nain(string srgst]) throws ToException { // Line 16 ew AirPlane(); // tine th ? } options: Compile error at dine 1e, main() must throw also Runtinesxception 5! Compile error at Line 11° ,new AirPlane() must be within ry/eatch block ce 10 8 oo What is the expected output? interface Folceble ( ‘public void fold() throws Exception, ‘ass Paper inplenents Foldable ( public vote fola() { // line © Systen.out.print ("Pola public clase Tester { public static void main(string ergs []) Foldable obji = new Papers opja.fold(); // ine 8 Paper obj2'" nen Paper(); // Line 18 oojz.folat); d > options A FotaFote 8. Gomplation error at Line 6, fold() must declare at header throws exception €!— Campiation error at Line 8, Unhandled exception D.—Runtinetxeeption at Line 8 £! Compilation error at Line 10, unhandled exception ps 72.65.17 408 PacemenCarmonAcion spoarcanlingtnatoneoraneack tn 106 wv ° _ 8 wc What is the result of compiling and running the following code? public clase Tester { public static void main(stringt] ange) { Syetem.out.prine("4")3, ty systen.out print(*2"); System-exdt(@); } finanny System.out-print("3")5 ; > ) options: a as C.Conpitation error , there should be at least one caten before Finally 8 10 A lihat is the result of compiling and running the following code? public class Tester { public static void main(string[] args) { system.out.print ("1"); try { return } catch (Exception e) { Systen.out.print("2"); } finally { Systen.out print ("3"); d System-out.print ("4"); t } Please choose only one answer: AL 3234 8. 1B Ea 1 D. Compilation error . 10 What is the result of compiling and running the following progran? public class Taster { public static void main(stringl] args) { try { ‘throw new Runtimetxception(); } catch (Runtimetxception e) { Systen.out. printin( "Runtimetxception") } catch (Arithmeticexception e) { System.out. printin("Arithmeticexception"); } catch (Exception e) { Systom.out.printin(“exception”) ; y + d options: 8 “RuntineBxception” is printed 8 "Exception" is printed c warithmeticexception” is printed ° conpiiation error c 10» ps 72.65.17 408 PacemenCarmonAcion spoarcanlingtnatoneoraneack tn oo 00 00 00Wihat is the result of compiling and running the following code? public class Tester { static void method() throws Exception { throw new Exception(); Public static void main(String[] args) { try { method(); } catch (Throwable e) { try { throw new Exception() 5 } catch (Exception ex) { System. out print(“exception" } finally { System.out print ("Finally"); y + } } Options: AL “exception” is printed 8. “Finally” is printed c. “exceptionfinally" is printed D Compilation error 20 b won oo What is the result of compiling and running the following code? public class Tester { static void method(){ ‘throw new Exception(); , public static void main(string[] args) { try { methed(); } catch (Throwable e) { try { throw new Exception() ; } catch (Exception ex) { System.out. print(“exception") } finally { System.out.print(“Finally"); } + + } options: AL exception 8. finally & exceptionfinally D. Compilation error 2 © wc 10 What is the result of compiling and running the following code? public class Tester { public static void main(String[] args) { String stmt = "Javachanp 20@9"; String[] arr = stmt.split(" "); try { int x = Integer.parsetnt(arr[1])5 System.out.print (x); } finaly { System.out.print ("Finally"); ¥ } 2 Options: A 2608 8. Finally lo. 2009Finally D. No output will be produced gE. Compilation error 2 c wc 10 p26. 400 cemancenmontton eprops tn m02 24 26 ip... 17408 Pcementerwroctonctprensat What is the result of compiling end running the following code? public class Tester { public static void main(string{] args) ¢ ‘String stmt = "javachamp 2009"; String[] arr = stmt.split(" "); try { int x = Integer. parsetnt(arr[0]); ‘System. out. print(x); } catch (Exception e) { system.out .print("catch"); } #inanay { ‘System. out. print ("finally"); } Options: 2009 2e09Finally catchfinally No output will be produced Compilation error 2e08catchFinally In which case a NoClassDefFoundError will be thrown? Options: A. When try to compile a non found java file B. When try to run a non found java .class file a. When try to compile a non found java file What is the output of the following code public class Tester { public static void main(String[] args) { Double d = -4.05 try { a /= 9; } catch (Arithmeticexception e) { System. out.print1n("EXCEPTION!") ; } finally { ‘System.out.printin(d) ; + } + Please choose only one answer: A NotANumber B. NaN ic. EXCEPTION! -4.0 D. -Infinity E. EXCEPTION! 0.0 F. Compilation fails 10 00 002% 2 ip... 17 408 Pacemeniarwrnacton dpe What is the output for the below code ? package com; class Animal { public void printName(){ System.out .printin("Animal"); } } package exam; import com.Animal; public class Cat extends Animal { public void printName(){ System.out .printin("Cat"); } } package exam; import com.Animal ; public class Test { public static void main(string[] args){ Animal a = new Cat(); a.printName(); } + : Options: A.Animal B.Cat C.Animal Cat D.Compile Error A 10 A 10 What is the output for the below code ? package bean; public class Abe { public static int index_val = 10; : package com; import static bean.Abc.index_val; public class Testi { public static void main(String... args) { System. out .printIn(index_val); } } Options: A.18 B.compile error, index_val not defined C.Compile error at import static bean.Abc.index_val; D.None of the above 8 108 oo What is the result of compiling and running the following progran? public class Tester { final static int x[] = new int[5]; public static void main(string{] args) { final int x = new Tester().x[5]; if (x @ 10) System. out.printin("Javachamp"); } > Options A. Compilation error 8. —_ArrayIndexOutofBoundsException is thrown & Javachanp D. No output is produced 8 10 A oo2 30 hat is the expected output? public class Tester { private Tester(int w) { // line 1 System. out.printin(); » public Final Tester() { // line 5 System. out.printin(1¢); » public static vold main(string argef]) { Tester obj = new Tester(50); , ¥ Please choose only one answer: A Won't compile because of line (1) - constructor can't be private 8 Won't compile because of line (5) - constructor can't be final c. 5° 9. 16 E 5e 8 10 8 10 lihich of the Following is true? Please choose all the answers that apply 1. When a class marked final, it cannot be extended 2. When a method marked final, it cannot be overridden 3. When a method marked final, it cannot be overloaded 4) Local variables of @ method cannot be Final 5. A -variable of a primitive type (int,float,..) which marked final, ite value at initialization cannot be changed options: AL 1,34 are correct 8. 1,2)5 are correct call’ are Correct DB. ALL are Wrong. 8 woe a0 Correct the Fellini code final class x2 Final 24() { System.out-orint(8); } // Line 2 Final int 8 = 3; ‘Hal private void dastutf() () // Tine 2 lass x2 extends x1 // Line 3 ‘ final int 8 = 95 Final static void dostuff() ( systen.out.printin(*hello fom 2"): ) : public class Test extends x2 ‘ public totic vedi main(Strspat] imi) c aostutfO;, neu Test) doSturF()s seatie void aastutt() {} // Line vols dostuff(int ars) {_ System out-printla("helle fron Test*); } J/ Line 5 ) de Ethie Gan oot webs owrcomstructor Tif becouse $8 Git Gili Sta. 0" It can not be anjuoy ovenntdden 2. Looe 3°" Gan nat extend/subclase a final clase Se Cen etc dred he come varie ol etl noes ete Scape pcinaylil 2. ine’ -"can nat overrige 9 final dnherdted nethod 6. Line 2» “final” ean not be nixed with "private" Options « she" one cormect (@ karpagar Universty - Al Rights Reserved 2015 ps 72.65.17 408 PacemenCarmonAcion spoarcanlingtnatoneoraneack tn rao
You might also like
Capgemini Aptitude Questions
PDF
No ratings yet
Capgemini Aptitude Questions
48 pages
Exam 1 Questions
PDF
No ratings yet
Exam 1 Questions
10 pages
Language Fundamentals
PDF
No ratings yet
Language Fundamentals
34 pages
Exercices - Certification Oracle 1Z0-803
PDF
No ratings yet
Exercices - Certification Oracle 1Z0-803
147 pages
Chapter 3
PDF
67% (3)
Chapter 3
2 pages
MCQ Core Java
PDF
No ratings yet
MCQ Core Java
12 pages
Java MockExam - 7
PDF
No ratings yet
Java MockExam - 7
23 pages
Module3A Assessment
PDF
No ratings yet
Module3A Assessment
8 pages
Lpu Cse310 Day 4 Ca3 Slot 2 Set 4
PDF
No ratings yet
Lpu Cse310 Day 4 Ca3 Slot 2 Set 4
8 pages
Ocpjp 6 Free Mock Exam Practice Questions
PDF
No ratings yet
Ocpjp 6 Free Mock Exam Practice Questions
33 pages
Construction Technology Unit 1
PDF
100% (1)
Construction Technology Unit 1
43 pages
AR6512-Site Analysis and Planning
PDF
75% (4)
AR6512-Site Analysis and Planning
65 pages
Milestine 1 MCQ Questions - Removed
PDF
No ratings yet
Milestine 1 MCQ Questions - Removed
53 pages
All Quiz Ques
PDF
No ratings yet
All Quiz Ques
63 pages
Test 1
PDF
No ratings yet
Test 1
31 pages
Auto Cad Question
PDF
No ratings yet
Auto Cad Question
45 pages
1z0 808 PDF
PDF
No ratings yet
1z0 808 PDF
9 pages
CCANZ Apt Design Guide 2014 PDF
PDF
No ratings yet
CCANZ Apt Design Guide 2014 PDF
52 pages
Java Test
PDF
No ratings yet
Java Test
20 pages
Actual Test - Sun Certified Web Component Developer For The Java 2 Platform, Enterprise Edition 1.4 (310-081)
PDF
No ratings yet
Actual Test - Sun Certified Web Component Developer For The Java 2 Platform, Enterprise Edition 1.4 (310-081)
44 pages
Questions
PDF
No ratings yet
Questions
36 pages
Java MCQ
PDF
No ratings yet
Java MCQ
12 pages
Laborator 1 - Prezentare Generala A Limbajului JAVA
PDF
No ratings yet
Laborator 1 - Prezentare Generala A Limbajului JAVA
31 pages
Java 8 (Guía 2) - Examen
PDF
No ratings yet
Java 8 (Guía 2) - Examen
31 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
QCM1 Préparation À La Certification Java Hamdi Firas
PDF
No ratings yet
QCM1 Préparation À La Certification Java Hamdi Firas
9 pages
Capgemini Easy Writting
PDF
100% (1)
Capgemini Easy Writting
2 pages
5.exception Handling
PDF
No ratings yet
5.exception Handling
8 pages
Question 1
PDF
No ratings yet
Question 1
59 pages
Core Java
PDF
No ratings yet
Core Java
42 pages
Exception Quest
PDF
No ratings yet
Exception Quest
19 pages
WrittenTest On CoreJava
PDF
No ratings yet
WrittenTest On CoreJava
9 pages
Event-III Java
PDF
No ratings yet
Event-III Java
15 pages
Java MCQs 1
PDF
No ratings yet
Java MCQs 1
39 pages
Cts
PDF
No ratings yet
Cts
24 pages
Cts
PDF
No ratings yet
Cts
24 pages
KLL
PDF
No ratings yet
KLL
48 pages
Question 1
PDF
No ratings yet
Question 1
30 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
Java Kolio Klausimai
PDF
No ratings yet
Java Kolio Klausimai
35 pages
SCJP
PDF
No ratings yet
SCJP
55 pages
Java Execption Handling
PDF
No ratings yet
Java Execption Handling
13 pages
KVTN16176914 1524043 PDF
PDF
No ratings yet
KVTN16176914 1524043 PDF
1 page
First Floor PDF
PDF
No ratings yet
First Floor PDF
1 page
Anna University
PDF
No ratings yet
Anna University
1 page
Exercice1 Partie1
PDF
No ratings yet
Exercice1 Partie1
3 pages
MCQ Java 1 Discussion
PDF
No ratings yet
MCQ Java 1 Discussion
15 pages
Progress-Test1 K15
PDF
No ratings yet
Progress-Test1 K15
9 pages
Padmanathapuram Palace
PDF
No ratings yet
Padmanathapuram Palace
31 pages
Exam Oracle Java 1Z0-808
PDF
No ratings yet
Exam Oracle Java 1Z0-808
9 pages
Core Java Test Questions
PDF
100% (1)
Core Java Test Questions
13 pages
Congrats !!! You Have Successfully Completed The Session:) ..
PDF
No ratings yet
Congrats !!! You Have Successfully Completed The Session:) ..
10 pages
SCJP Mock Exam
PDF
No ratings yet
SCJP Mock Exam
16 pages
Actual Test SCJP 1
PDF
No ratings yet
Actual Test SCJP 1
46 pages
Human Settlements Unit 4
PDF
No ratings yet
Human Settlements Unit 4
31 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
Milestones BITS Final
PDF
No ratings yet
Milestones BITS Final
87 pages
Java Placement Questions
PDF
No ratings yet
Java Placement Questions
23 pages
Exception Handling
PDF
No ratings yet
Exception Handling
11 pages
Java Test Paper
PDF
No ratings yet
Java Test Paper
8 pages
Aptitude MCQ For Beginners
PDF
No ratings yet
Aptitude MCQ For Beginners
29 pages
11
PDF
No ratings yet
11
13 pages
mcq-1 - Core Java
PDF
0% (1)
mcq-1 - Core Java
5 pages
Java Programming Moc Test
PDF
No ratings yet
Java Programming Moc Test
31 pages
Most Asked Java Interview Questions
PDF
No ratings yet
Most Asked Java Interview Questions
14 pages
Polo Retreat.: Thesis Synopsis
PDF
0% (2)
Polo Retreat.: Thesis Synopsis
3 pages
Test Q
PDF
No ratings yet
Test Q
25 pages
Java Que Paper
PDF
No ratings yet
Java Que Paper
6 pages
Question Bank For J2SE
PDF
No ratings yet
Question Bank For J2SE
3 pages
Core Java: Time: 1.30 Hrs
PDF
No ratings yet
Core Java: Time: 1.30 Hrs
9 pages
IELTS Writing Task 1 - Vocabulary For Graphs
PDF
99% (82)
IELTS Writing Task 1 - Vocabulary For Graphs
11 pages