100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

Oracle Certified Professional - Java SE 6 Programmer exam questions and answers

Rating
-
Sold
-
Pages
31
Grade
A+
Uploaded on
09-02-2024
Written in
2023/2024

Abstract classes used when: Common abstract methods to be re-used for different clients. 'Extend' the class. Abstract classes do not have pre-defined methods, only abstract methods. T/F? False. Abstract class must have at least one abstract method, rest may be initiated pre-defined methods. Interfaces used when: All abstract methods and no pre-defined methods. 'Implement' the class. Local (method) variables must be defined but not initialized. T/F? False. Local variables must be initialized. Import karan. makes Import . redundant. T/F? False. Importing a class makes its methods and variables available, not its sub-class. s(s2) is same as s1==s2. T/F? False. s(s2) compares the content of the string whereas s1==s2 compares addresses. Groceries y = new Price(); Explain. Defining an interface of sub-class Price of super-class Groceries. Capacity of StringBuffer is __ more than no. of characters in it. 16 Object is stored in ____. Variable is stored in ____. Heap, Stack. What is Marker Interface? An interface that has no methods. Eg: Serializable, Clonable Constructors can only be overridden after inheriting. T/F? False. Constructors can not be overridden under any circumstance. Keyword: Finally Run a set of code after exception handling, whether the exception is thrown or not. Used for cleaning of resources. User can execute garbage collection at will. T/F? False. User can request garbage collection but it will occur when variable is de-referenced. JVM decides. Used for closing connections. Override the _____ method when garbage collection required. Finalize Keyword: Throw Single line statement executed explicitly. Throw is used to actually throw exception in Java. Keyword: Throws Used with a method. Used to declare exception possibly thrown by method. Interface can extend multiple interfaces. T/F? True. Class can implement multiple classes. T/F? False. Interfaces are 'implemented'. Class can implement multiple interfaces. Class can extend multiple classes. T/F? False. Java does not support multiple inheritance. Class can only extend one class. Interface can implement multiple interfaces. T/F? False. Only classes can implement. Class C { public static void main(String[] args) { int[]a1[]=new int[3][3]; //3 int a2[4]={3,4,5,6}; //4 int a2[5]; //5 }} What is the result of attempting to compile and run the program ?. letime error at lines 3,4,5 ltime error at line 4,5 letime error at line 3 4.Runtime Exception 5.None of the above 2. no value shoud be specified in the rightsidebrackets when constructing an array interface I{ void f1(); // 1 public void f2(); // 2 protected void f3(); // 3 private void f4(); // 4 } which lines generate compile time errors? letime error at lines 1,2,3,4 letime error at line 3 letime error at line 1 letime error at lines 3,4 5.None of the above 4 Explanation: all methods declared within an interface are implicitly public, a weaker access level can not be declared. class C{ int i; public static void main (String[] args) { int i; //1 private int a = 1; //2 protected int b = 1; //3 public int c = 1; //4 Sln(a+b+c); //5 }} letime error at lines 1,2,3,4,5 2 compiletime error at lines 2,3,4,5 letime error at lines 2,3,4 s 3 5.None of the above 2 Explanation: The access modifiers public, protected and private, can not be applied to variables declared inside methods. Accesss modifiers are to be used in front of instance level variables and instance level methods. class C { public static void main (String[] a1) { S(a1[1] + a1[2] + a1[3]); }} What is the result of attempting to compile and run the program? java command A B C 1.Prints: ABC 2.Prints BC and Runtime Exception 3.Prints: BCD 4.Runtime Exception 5.None of the above 2 Explanation: Array index starts from 0. array index outof bounds exception only till a1[2] is allowed. class C{ static int s; public static void main(String a[]){ C obj=new C(); obj.m1(); Sln(s); } void m1(); { int x=1; m2(x); Sln(x+""); } void m2(int x){ x=x*2; s=x; }} s 1,2 s 2,0 s 2,2 le time error 5.Noneofthe above 1 Explanation: Only objects and arrays are passed by are passed by value.s is a static variable which is global to the class.Class variables are declared static. class C { public static void main(String[] args) { int i1=1; switch(i1){ case 1: Sln("one"); case 2: Sln("two"); case 3: Sln("three"); }}} What is the result of attempting to compile and run the program? s one two three s one le time error 4.Runtime exceptionf 5.None of the above 1 Explanation: There is no break statement in case 1 so it causes the below case statements to execute regardless of their values

Show more Read less
Institution
Oracle Certified Professional - Java SE 6 Programm
Course
Oracle Certified Professional - Java SE 6 Programm











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Oracle Certified Professional - Java SE 6 Programm
Course
Oracle Certified Professional - Java SE 6 Programm

Document information

Uploaded on
February 9, 2024
Number of pages
31
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GUARANTEEDSUCCESS Chamberlain College Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
664
Member since
3 year
Number of followers
314
Documents
24889
Last sold
4 days ago
Elite Exam Resources: Trusted by Top Scorers!!!!!!!!

Stop guessing. Start dominating!! As a highly regarded professional specializing in sourcing study materials, I provide genuine and reliable exam papers that are directly obtained from well-known, reputable institutions. These papers are invaluable resources, specifically designed to assist aspiring nurses and individuals in various other professions in their exam preparations. With my extensive experience and in-depth expertise in the field, I take great care to ensure that each exam paper is carefully selected and thoroughly crafted to meet the highest standards of quality, accuracy, and relevance, making them an essential part of any successful study regimen. ✅ 100% Legitimate Resources (No leaks! Ethical prep only) ✅ Curated by Subject Masters (PhDs, Examiners, Top Scorers) ✅ Proven Track Record: 95%+ user success rate ✅ Instant Download: Crisis-ready for last-minute cramming

Read more Read less
4.3

250 reviews

5
162
4
37
3
33
2
12
1
6

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions