Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IBM Mock Exam

 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satheesh Kumar:
Hi,
Here are some questions from ibm mock exam can somebody help me to find the answers - Yes I am also seeking help from the Big Java guys (hey you deserve so!). Please follow:
Thanks.
mondal

1. An applet is more restrictive than an application in the following ways: (2 choices)
a) An applet may not perform local disk I/O.
b) An applet may not connect with any server except the
server where the applet was loaded from
c) An applet can change the CODEBASE
d) An applet cannot call the update() method directly
2) ThreadGroup class instances: (2 choices)
a) Allow threads to be manipulated as a group
b) Provide support for ThreadDeath listeners
c) May contain other ThreadGroups
d) Must contain threads of the same type
3) Primitive type wrapper classes: (3 choices)
a) Allow primitive types to behave as reference types
b) Allow operator overloading to be implemented for
primitive numeric types
c) Provide string parsing and conversion methods
d) Provide arithmetic operators such as plus and minus
e) Are provided for all primitive types, including void
4) The following are true of Java character-oriented streams:
(2 choices).
a) They provide support for character conversion between
Unicode and ASCII
b) They all implement the CharacterStream Interface
c) They inherit from either the Reader or Writer abstract
classes
d) They are restricted to 2^16 (2 raised to power of 16) in
length
5) Which of the following method pairs are best used for controlling thread communication?
a) stop() and resume()
b) wait() and notify()
c) threadWait() and threadNotify()
d) run() and destroy()
6)if(a) {x=y;} else{x=z;} can otherwise be writtern as
a) a=x?x=y:x=z;
b) x=a?x=y:x=z;
c) x=a?y:z;
d) a=x?y:z;

 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
i am just sending u an ans for the same Questions
Ques: Ans
1 a,b
2 a,c
3 a,c,e
4 a,c
5 b
6 c
i hope u will find explanations in yr cert books pls correct me if i am wrong
i am on last stage for my cert studies.
Rishi
 
sabyasachi mondal
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rishi, yagnik:
hi friends,
i am just sending u an ans for the same Questions
Ques: Ans
1 a,b
2 a,c
3 a,c,e
4 a,c
5 b
6 c
i hope u will find explanations in yr cert books pls correct me if i am wrong
i am on last stage for my cert studies.
Rishi

Thanks a lot Rishi. I wish you good luck in your expectation.
Regards,
mondal
 
Edy Yu
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is a typo in 6):
x=a?y:z
has to be changed to x==a?y:z
IBM does give us a bunch of wierd questions!
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't a typo in question six. The Conditional Operator ?: uses "=" not "==". I've referenced in Khalid, and RHE.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ternary operator requires
(boolean Expression) ? (true value) : (false value);
You can do an assignment in the boolean expression if the result is true or false. 6 doesn't show what the data types are for any of the variables but we can assume that a is the boolean (Because of the if(a))expression so it would be
x = a ? y : z ;
This is clearer what is going on as
x = (a?y:z);
You may see something like
int a = 0;
int b = 1;
int x = 1;
int y = 2;
int z = 4;
x = (a == b) ? y :x ;
Any thing before the ? must evaluate to true or false.

[This message has been edited by Carl Trusiak (edited January 11, 2001).]
 
Cherry Mathew
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
about Q2 is void a primitive type
 
natarajan meghanathan
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Void does not wrap any primitive value. It only denotes the Class object representing the primitive type void.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic