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

QUIZ 001.Questions related to core java?

 
Nitish Agrawal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1.The fucntion that will compare two strings without case sensitivity?

A1. OPTIONS are : (1) string.ignoreCase(String)
(2) string.equalsIgnoreCase(String)

Q2.The listener which invokes on the container & displays its state is:
A2.

Q3.The exception that raises by not initializing a component in the panel is:
A3. 1.array out of bounds
2.null pointer
3.arithmetic exception

Q4.the try block can contain no of catch blocks & they will be executed in the order is:
A4. 1.sequential
2.based on exxception
3.random

Q5.The CLASS that handles data input from the console is:
A5. 1.InputStream
2.SYstem.in
3.System.out
4.OutputStream

Q6.the container of the component class can be accessed thru the method:
A6. 1. getContainer()
2.getComponent()
3.getContentpane()
4.getContent()

Q7. which all of the following equates to true:
where s1="yes",s2="yes",s3="yes" all hving d same value;
A7.1. s1==s2
2. s3==s1
3. s1.equals(s2)
4. s3.equals(s1)

Q8.which of the following classes are available in the java.lang package?
A8.1.stack
2.object
3.math
4.random
5.string
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you would benefit reading this and this.
[ July 21, 2008: Message edited by: Paul Sturrock ]
 
Nitish Agrawal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you guys dont know the answers then its ok,
no need to giv me any links.
I can understand that questions are not so easy for you.
well thanks for your suggestions.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Adlakha:
I can understand that questions are not so easy for you.


Nobody said anything about the questions being easy or hard. Paul was just pointing out that this forum is not the place to come if you want your homework doing for you. If you tell us what you think the answers are and why, then people will be happy to explain any mistakes you have made, but you have to show that you've made some effort.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Precisely. The point I was trying to impress on you is if all you want is the answers you will probably find someone somewhere who will give them to you. However, the goal of this site is to point people in the right direction so they can learn how to answer questions like these themselves. So that source of easy answers is probably not here.

As Joanne says, tell us what you think the answers might be, and why, or explain which parts you are struggling to understand, and someone will be more than happy to help.
 
Shikhar Madhok
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Adlakha:
Q1.The fucntion that will compare two strings without case sensitivity?

A1. OPTIONS are : (1) string.ignoreCase(String)
(2) string.equalsIgnoreCase(String)
should be 2

Q2.The listener which invokes on the container & displays its state is:
A2.ContainerListener? Taking a guess did not read the API properly just saw that there was an interface by this name

Q3.The exception that raises by not initializing a component in the panel is:
A3. 1.array out of bounds
2.null pointer
3.arithmetic exception
2. null pointer? Taking a guess again here. This is was usually happens in Java I think if an object is not initialized.

Q4.the try block can contain no of catch blocks & they will be executed in the order is:
A4. 1.sequential
2.based on exxception
3.random
2 based on the exception.

Q5.The CLASS that handles data input from the console is:
A5. 1.InputStream
2.SYstem.in
3.System.out
4.OutputStream
System.in - had to check API for this,

Q6.the container of the component class can be accessed thru the method:
A6. 1. getContainer()
2.getComponent()
3.getContentpane()
4.getContent()
Could not find these methods in the API. Found getParent() which returns the Container.

Q7. which all of the following equates to true:
where s1="yes",s2="yes",s3="yes" all hving d same value;
A7.1. s1==s2
2. s3==s1
3. s1.equals(s2)
4. s3.equals(s1)
3 and 4. == compares object reference. I think s1, s2 and s3 are different objects

Q8.which of the following classes are available in the java.lang package?
A8.1.stack
2.object
3.math
4.random
5.string
2 and 5. Stack should probably be part of util with other collections, math is a separate package. Random is probably part of math, confirmed it is not part of lang


My answers in italics.

Shikhar
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q5 - System.in is not a class, it's a field in the System class.

Q7 - The answer is all of them. Search these forums for 'string pool'.

Q8 - The answer is none of them. Java is case sensitive.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have already looked at case sensitivity with toUppercase and toUpperCase, but you can find a list of the classes in the java.lang package from the API documentation, probably here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic