Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

more tiger questions

 
Zak Guesmia
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q17 : what would be the output of this program? (Choose One)

a) one two one two
b) one one one two
c) one two one one
d) the program won't compile
e) none of the above

Q18 : what would be the output of this program? (Choose One)

a) 15 138 15 138
b) 15 138 0 0
c) 0 0 0 0
d) 0 0 15 138
e) the program won't compile

Q19: Given the following chunk of code, select two correct statement

a) the code compiles successfully
b) the would compile if you parametrize myIntList, to be "List<int[]> myIntList" in Line 2
c) the would compile if you de-parametrize floatNumbers, to be "List floatNumbers" in Line 8
d) the code would compile if you substitute "float i : floatNumbers" in Line 12 by "Float i : floatNumbers"
e) the code would compile if you substitute "Integer i : myIntList" in Line 4 by "int i : myIntList"
f) the code would compile if you substitute "Integer i : myIntList" in Line 4 by "Object i : myIntList"
g) none of the above


Q20: Given the following code, select the correct statement

a) the code compiles successfully
b) ClassCastException
c) IllegalFormatConversionException
d) the program would compile if you decalare ShowWinners as abstract
e)the code doesnt compile because asList(int...) is not defined in java.util.Arrays
f) none of the above

Q21 : Choose the correct answer.

a) The code compiles successfully.
b) the code doesnt compile bc Iterable is not part of java.util
c) the code would compile if TextFile doesnt implement Iterable
d) the code would compile if you replace BuffredReader by InputStreamReader
e) none of the above

Refer to the 16 previous questions on the thread :
---------------------------------------------------------
mock questions


( tags added)
[ January 10, 2005: Message edited by: Barry Gaunt ]
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Shouldn't the output be

15 138 138 0
?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The output is indeed 15 138 138 0. But I guess the following line has a typo:

numbers[0]= 138;

It should be:

numbers[1] = 138;

Then you get 15 138 15 138 (option a).
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zachariah

Good work. Keep them coming.
 
Zak Guesmia
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all beta testers,

Everybody has to contribute i cannot afford covering all the objectives by myself.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
19 : f
20 : f
21:e
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
17)one two one one
18)15 138 138 0
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all beta testers,

Everybody has to contribute i cannot afford covering all the objectives by myself.


here one.

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
few more questions


 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you can find the sample chapter for varargs,

Varargs in Tiger
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answres

2
1
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.

Varargs can be only the final paramter of a method.

(String... arg1, String str) - not a valid method declaration.
it can be like this : (String str,String... arg)



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic