• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Three interesting questions from javacross exam

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Q1) How do arrange components in FlowLayout?

(i) North, East, West, South
(ii) U dont do anything. FlowLayout arranges them by itself.

Ans given : (i).

Q2) Which keyword does not affect the flow of the program.
(i) for
(ii) break
(iii) continue
(iv) synchronized

Ans given : (iv).

Q3) Which of the following creates a final variable accessed globally :
(i) public final static String s="Global";
(ii) public final String s="Global";

Answer given : (i).

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tha answer for first question is choice 2 if it is flowlayout .
------------------
"Winners don't do different things
They do things differently"
 
amit sanghai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Sunilkumar.
what about the 2nd and 3rd questions?
I think the answer to the 2nd question is "for".
I think the answer to the 3rd question can be (ii) also.
 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer to question one is definitely (ii).
The answer to the second question is definitely synchronized. The first three answers are used to control the flow of a program in control structures, while synchronized is used predominantly with methods, so it doesn't effect the control flow.
The answer to the third question cannot be (ii) also. In order for it to be accessed globally it needs to be a static variable, otherwise it'll be an instance variable and each member will access it internally and not globally.
 
amit sanghai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Sean for clearing my doubts.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi can you tell me the url for the javacross exam!!!
thanks for the questions.
 
amit sanghai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi Noel, it is www.javacross.com. The site is under construction, however, there is one link where you can take a quick sample test.

Bye.
 
Noel Hinders
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amit
 
Noel Hinders
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amit,
I did not find links for the advanced mode could you help me to find it?
Regards
Noel.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Noel,
I have mailed to the support team, they replied that the site is under construction, also 3 levels of online simulations will be available in a few days also they are intriducing a new cbt known as probe learning system and it seems to be promising
enjoy!
 
Noel Hinders
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi madhu,
can you mail me the solutions for the practice exam I couldn't get proper explanations for the questions.
Please mail me the solutions to noel_hinders2000@yahoo.com
Thanks a lot.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi AMIT,
the Answer according 2 me:
q1...(ii)...it is true for Applet and Panel.
q2...(iv)..its' correct
q3....(ii)
If i am rong ...pls..correct me.
Ratul Banerjee

Originally posted by amit sanghai:

Q1) How do arrange components in FlowLayout?

(i) North, East, West, South
(ii) U dont do anything. FlowLayout arranges them by itself.

Ans given : (i).

Q2) Which keyword does not affect the flow of the program.
(i) for
(ii) break
(iii) continue
(iv) synchronized

Ans given : (iv).

Q3) Which of the following creates a final variable accessed globally :
(i) public final static String s="Global";
(ii) public final String s="Global";

Answer given : (i).


 
Noel Hinders
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ban ,
can u explain me the solutions.
Thanking you in advance.
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ban,
you are wrong about your third answer. In order for it to be accessed "globally" it needs to be a static variable.
 
Rat Ban
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Sean,
Sorry...I didn't mean it.The answer of the 3rd q. will be 1
thanks.

Originally posted by Sean Casey:
ban,
you are wrong about your third answer. In order for it to be accessed "globally" it needs to be a static variable.



[This message has been edited by Rat Ban (edited January 23, 2001).]
 
Noel Hinders
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
can any one post the explanation for those above questions.
Thanking you.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
my explanations are as under:
(1) the first is right because flowlayout is used to layout components of container object in the left to right and top to bottom fashion.
Hence two is definitely wrong
(2) the first three are not right because the control is explicit in any flow whereas definitely the fourth is right because synchronised thread coordinates access to synchronised methods and statements and keeps the methods in multiplied threads from conflicting with one another. For eg. The synchronised method is allowed to access class or objects by means of a lock, when the thread gets the lock, it is executed without any interuption, whatsoever, unless a wait() is deliberately inserted in the midst of the code.
(3)the diff is between static and non static.
obviously non static variables are created when the object is created and exists until the object is garbage collected Whereas static variables comes into existence when the class in which they are declared is loaded. they exist till the class exists. so the first is correct
regards
venkat
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Explanations:
1. FlowLayout lays out the items left to right and top to bottom, it doesn't use North, South, East, and West. That is BorderLayout. So answer is "ii"
2. for starts a loop (a flow type of statement), break stops the loop, and continue stops the current iteration of the loop. Synchronized tells you that it will lock the object before calling that method, nothing to do with flow. So answer is "iv"
3. To be global and final, it needs to be public to make it global and static so it accessible without an instance of the class. Don't really care for the question, because Java doesn't really think of things "globally" like VB might. Question should say what is the proper way to create a constant that any class can access. And the answer to that would be "i".
Bill
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way,
Do not trust all the answers of this test.
For example, they consider that static methods could be overloaded, but not overriden. You can check it by running this program:
class Test {
static void show() {
System.out.println("static method in Test");
}
}
public class TestStatic extends Test {
static void show() {
System.out.println("Overridden static method in Q3");
}
public static void main(String[] args) {
TestStatic a = new TestStatic();
show();
}
}
If you slightly modify it and make either of this method static, then you will have compilation error for neither you can override static methods by non-static and vice verse.
I think the speed of this test Sun should for sure appreciate.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic