Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

7 types of questions in Java Certification exams (OCA Java 7/8)

 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone -

I've put together a list of the types of questions (with examples) that you would need to answer in your Java certification exams (OCA Java 7/8):

http://ejavaguru.com/examquestiontypes.html

I hope it helps you to understand the exam better.

With much respect,
Mala
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to be really patient before the page is loaded. On my computer (with a wired internet connection) it requires 2 minutes for the page to load using Google Chrome. At a first glance the page contains nothing but some text and images, so that's pretty poor performance. Also the link at the bottom to the OCA Java SE 8 Certification Guide doesn't work.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:You'll have to be really patient before the page is loaded. On my computer (with a wired internet connection) it requires 2 minutes for the page to load using Google Chrome. At a first glance the page contains nothing but some text and images, so that's pretty poor performance.

It seems the performance is much better now! The page loads in less than 10 seconds, even with browser cache disabled. Maybe it's cached somewhere else. Will try at home tonight.

[edit] I tried it at home and the page still loads in less than 10 seconds. So performance seems to be acceptable now.
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Also the link at the bottom to the OCA Java SE 8 Certification Guide doesn't work.


Hi Roel -

Are you referring to the link included in my signature?

With much respect,
Mala
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mala Gupta wrote:Are you referring to the link included in my signature?

No! I am referring to the link at the bottom of the article you have shared in this topic
Good Luck to you.

With much respect,
Mala

Author of Manning's OCA Java SE 8 Certification Guide
 
Pero Rooo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you please upload a new or better version becouse i cannot load that webpage..
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Roel. I'll update the page soon so that the link to the book refers to the book's page hosted with Manning Publications (http://www.manning.com/gupta3).


Pero Rooo wrote:could you please upload a new or better version becouse i cannot load that webpage..


Hi Pero -

Please try to access this page again.

Thanks.

With much respect,
Mala
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mala Gupta wrote:Thanks, Roel. I'll update the page soon so that the link to the book refers to the book's page hosted with Manning Publications

That's not the issue! The publisher's page of the study guide works fine. It's an issue in the page itself. This is the source code of the link in that lineBecause the url misses the http:// part, the browser renders the url as http://ejavaguru.com/www.manning.com/gupta3

If you change the value of the href attribute to http://www.manning.com/gupta3 (like you did in the Publications section in the footer) it will work like a charm
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
 
Claudiu Stroe
Greenhorn
Posts: 29
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this examples the class name in the code is like
class JavaCertQType1
and they ask us to answer for executing class QuestionType3 but with the command
java QType3 1 11 EJava Guru
.
Isn't it tricky?!



Running command
java QType3 1 11 EJava Guru
will throw an error: class QType3 not found.


There is no option for this kind of answer.
What is the corect answer in this situation ?

The code compile ok : javac JavaCertQtype1.java , but it will throw an ArrayIndexOutOfBoundsException if args.lenght<2

Running command
java JavaCertQType1 1 11 EJava Guru
it will output 111 so option c is correct.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claudiu Stroe wrote:Isn't it tricky?!

Based on the question in the code snippet, it's not tricky but an (unintended) typo. Clearly this type of question was supposed to be type 3, but then got promoted to type 1 but the question and command was not updated accordingly.

Claudiu Stroe wrote:Running command
java QType3 1 11 EJava Guru
will throw an error: class QType3 not found.

There is no option for this kind of answer.
What is the corect answer in this situation ?

Assuming it was intended to have a wrong class name in the java command, the correct answer would probably be option g (runtime exception). And then it would be an example of type 3 The code snippet itself compiles successfully, so option f (compiler error) is incorrect. Because a wrong class name is used, it will definitely not produce any output (and thus options a, b, c, d, and, e are incorrect). So that's why the only remaining option g is the correct one.

Claudiu Stroe wrote:The code compile ok : javac JavaCertQtype1.java , but it will throw an ArrayIndexOutOfBoundsException if args.lenght<2

Because the java command is given and uses 4 program arguments, you'll never get an ArrayIndexOutOfBoundsException in this question.

Claudiu Stroe wrote:it will output 111 so option c is correct.

You are spot-on!

Hope it helps!
Kind regards,
Roel

PS. Have a cow for spotting this typo and creating an excellent post about it
 
Claudiu Stroe
Greenhorn
Posts: 29
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel!

So class not found is a runtime exception not an error as I thought.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claudiu Stroe wrote:So class not found is a runtime exception not an error as I thought.

Is "error" referring to "compiler error" or to "subclass of Error"? The first one is definitely not the case as you get the exception/error when you (try to) run the code (invoking the java command) and not when compiling the code (invoking the javac command). The latter one will be thrown at runtime. If not specified specifically, a runtime exception can refer to "something went wrong when running the code". Here you'll find a similar discussion about this terminology when the main method is not marked as static.
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for useful post, Mala

I want to add my notes too:

Exam Question type 1
There is another typo here, class name is JavaCertQType1.
What is the output when class QuestionType3 is executed using the following command (choose 1 option) :


Exam Question type 4
class name is JavaCertQType4.
Which option, when inserted indiviually at //INSERT CODE HERE will enable class QType4 to output value 10?


Exam Question type 5

Maybe you intend to write public instead of protected in option b, because main() method is protected in original code snippet.
b) Code will output the same result if access modifier of main() is changed to protected at line 2.


Hope it would be helpful
 
Claudiu Stroe
Greenhorn
Posts: 29
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding Exam Question Type 5 we have to select correct option (choose 1):



The code compiles succesfully even if we change line 6 with line 7 so option C and D are wrong.
If we put any acces modifier for method main() it will have the same result, so option B is correct
Also option A is correct if we comment line 6 it will still compile succesfully but we won't have the same result.

So correct options are A and B
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:Exam Question type 5
Maybe you intend to write public instead of protected in option b, because main() method is protected in original code snippet.
b) Code will output the same result if access modifier of main() is changed to protected at line 2.

Or maybe private (as it is more restrictive than protected).

(I agree with all your notes. Have a cow too!)
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claudiu Stroe wrote:So correct options are A and B

Spot-on! Have another cow for spotting another issue in the provided questions!
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote: (I agree with all your notes. Have a cow too!)


Thanks, Roel
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claudiu, Mushfiq and Roel -

Thanks a lot for spotting these errors and posting answers to queries. I've corrected them -

1) Question type 1 - corrected mismatch in the usage of class name.

2) Question type 4 - again, corrected the mismatch in the usage of class name :-)

3) Question type 5 - Changed protected to private in option b, changed the count of correct options to 2.

4) Fixed link to 'OCA Java SE 8 Certification I Guide' at the end of this article.


Hi Mushfiq -

Thanks for posting all the errors.
I'm pleased to learn that this post is useful for you. Just read one of the posts that included your certification results - OCA Java SE Programmer I. Congratulations on earning it with a very good score.

You'll find similar type of exam questions in the Java SE Programmer II cert as well.


Hi Claudiu -

Thanks for your comments and feedback.


Hi Roel -

Thanks for answering all the queries. You were spot on, when you mentioned that perhaps q3 was promoted to type Q1. :-)




With much respect,
Mala



 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mala Gupta wrote: Just read one of the posts that included your certification results - OCA Java SE Programmer I. Congratulations on earning it with a very good score.


Thanks for your attention, Mala
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:
Thanks for your attention, Mala


Good Luck to you :-)

With much respect,
Mala
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers -

If you have answered any other type of question (other than listed in the link shared in this post) in OCA Programmer II and or OCP Programmer II Java certification (version 7/8), please post it here. I'll include it in the list. It will help candidates who are preparing for their first Java exam.

Thanks.

With much respect,
Mala
 
Ramya Subraamanian
Ranch Hand
Posts: 178
17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mala Gupta wrote:If you have answered any other type of question (other than listed in the link shared in this post)


code + diagram representing the code =choose from answer options which are code inputs.

I got something like this

array indexes and their inputs in binary (like arr[1][1]=0 or 1)+ 2D array in a grid form with some characters(say p,q) like tic-tac-toe game.

The array was a int [][] but the grid had some other 2 characters.We had choose an array Index with input from the given options that will give you win.
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
 
Matija Ivanuš
Greenhorn
Posts: 2
1
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exam Question type 5

It states that there are 2 correct answers but there is only 1 correct answer B.
Answer A seems as correct but it says that code will compile "only if line 6 is commented", code will compile and run even if line 6 is not commented.
 
Ramya Subraamanian
Ranch Hand
Posts: 178
17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matija Ivanuš wrote:Answer A seems as correct but it says that code will compile "only if line 6 is commented", code will compile and run even if line 6 is not commented.

In these current options A seems incorrect. Yeah right, the code will run successfully even if line 6 was not commented.

The word "only" seems to be the problem here. If you remove that, then statement seems correct. "Code will compile successfully, if code on line 6 is commented"

I saw this question before the changes were made. If I remember correctly, "only" was not there and then Option A was true. So either "only" can be removed then, A and B will be the answers or select correct option can be changed to "choose 1" , then B alone will be the answer.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matija Ivanuš,

First of all, a warm welcome to CodeRanch!

Matija Ivanuš wrote:It states that there are 2 correct answers but there is only 1 correct answer B.
Answer A seems as correct but it says that code will compile "only if line 6 is commented", code will compile and run even if line 6 is not commented.

The exam tells you for each questions exactly how many answers to select. And although a lot of effort is made to have a high quality question bank, it's always possible that a question (or answer) has a typo or might be a little bit ambiguous. But you still have to select the given number of correct answers. And if you have already 2 definitely correct answers but need another one (as the question states to select 3 correct answers), a very good technique is eliminating all definitely wrong answers. And then you often have eliminated all other answers except the third correct one I had to do something similar when I took the OCAJP7 exam: I had to select an answer with an obvious compiler error as a correct answer, because all other answers were definitely wrong (for more information, click on the OCAJP7 link in my signature).

And you are correct about this question Have a cow! But it's nothing more than a typo: if you switch for example "only" and "if" in option A, you'll get a completely different statement "Code will successfully compile if only code on line 6 is commented", which is a true (and thus correct) statement

Hope it helps!
Kind regards,
Roel
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 4 states which option, which I take to mean that only one answer is correct, however both a and d will print 10 to the command line
 
A. Costa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mind explaining me why onw of the answers for type 6 is the B one? How could the acces modifier of a method in the same class change result of it?
If I had to pick one (besides A) I would go for C, but it says "runtime Exception" and I think that the executin of the code would throw an OutOfMemoryError not a runtime exception...but I'm not sure.

Could someone explain it?

Thanks a milion!
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nigel Browne wrote:Question 4 states which option, which I take to mean that only one answer is correct, however both a and d will print 10 to the command line

Probably nothing more than a typo, an "s" is missing. Should be: "Which options, when inserted individually...". In question 5 "option" is also missing an "s" at the end.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi A. Costa,

First of all, a warm welcome to CodeRanch!

A. Costa wrote:Do you mind explaining me why onw of the answers for type 6 is the B one? How could the acces modifier of a method in the same class change result of it?
If I had to pick one (besides A) I would go for C, but it says "runtime Exception" and I think that the executin of the code would throw an OutOfMemoryError not a runtime exception...but I'm not sure.

Let's go through each of the possible answers and see if it's correct or incorrect. Fasten your seatbelt, here we go!

a) incorrect --> the code compiles as-is, so you don't have to comment a line of code in order to make the code snippet compile
b) correct --> if we change the access modifier of the main() method at line6 to public, the code will output the same result. Changing a more restrictive access modifier (private) to a less restrictive access modifier (public) does not change the output in this code snippet.
c) incorrect --> when you execute this code, you'll get a StackOverflowError (not an OutOfMemoryError) at runtime. So the code compiles successfully but does throw a runtime exception. Note: a "runtime exception" is not the same as a "RuntimeException": the latter one refers to a class in the exception hierarchy which is the parent class of all unchecked exceptions, the first one just refers to an exceptional condition which happens at runtime. In fact, a "runtime exception" could be a checked exception, an unchecked exception or an Error (but not a compiler error).
d) correct --> if you switch both statements, a StackOverflowError will be thrown before "EJavaGuru" will be printed.

Hope it helps!
Kind regards,
Roel
 
A. Costa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Roel, that's what I thought!
 
Mala Gupta
Author
Ranch Hand
Posts: 363
11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramya Subraamanian wrote:
Mala Gupta wrote:If you have answered any other type of question (other than listed in the link shared in this post)


code + diagram representing the code =choose from answer options which are code inputs.

I got something like this

array indexes and their inputs in binary (like arr[1][1]=0 or 1)+ 2D array in a grid form with some characters(say p,q) like tic-tac-toe game.

The array was a int [][] but the grid had some other 2 characters.We had choose an array Index with input from the given options that will give you win.


Hi Ramya -

Here's a sample question for this type:



Thanks for your help.

With much respect,
Mala
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic