• 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

Interview questions

 
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
6. Which statement is true about a non-static inner class?
a) It must implement an interface
b) It is accessible from any other class
c) It can only be instantiated in the enclosing class
d) It can access private instance variables in the enclosing object
e) It must be final if it is declared in a method scope.

regards
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the obvious answer is c but i may not be correct. this sounds awfully like an exam question, i hope you're not using a laptop during your exam lol
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you kidding ! This is an interview question I got this morning. I could have breezed it about 2 years ago.
The fact that I got the same set of questions from a different agency same client a month ago is neither here nor there. This is the way the client likes to sift through prospective interviewees.

Now don't ask for the whole set of 20 questions.
regards
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
c and d. Please post more questions.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First.+ why are you sure about d. I might give y'all another one.
regards
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prints "Outer" so, d is correct.
Does Tester.InnerTester inner = new Tester().new InnerTester(); mean it was created outside of the enclosing class? That would make c false.
[ November 18, 2003: Message edited by: Steve Chernyak ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This was my reponse :
> > 6. Which statement is true about a non-static inner class?
> > c) It can only be instantiated in the enclosing class
> > d) It can access private instance variables in the enclosing object
> > e) It must be final if it is declared in a method scope. (Not sure about this answer - it seems a bit ambiguous)
about e)
c is correct IMHO. A single outer class can also have many instances of non-static inner classes if memory serves me right.

SC : Does Tester.InnerTester inner = new Tester().new InnerTester(); mean it was created outside of the enclosing class ?


new Tester(). is the enclosing class and new InnerTester() is created within it;
regards
[ November 18, 2003: Message edited by: HS Thomas ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

c is correct IMHO. A single outer class can also have many instances of non-static inner classes if memory serves me right.


Any examples come to mind ?
regards
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you have been such good sports , you can have another question.
( I didn't sign any non-disclosure agrrements. ) so I'll combine two questions into one .

4. Which of the following describe ways that dynamic information can be
made available to all servlet requests sent to an application and which of the following can be used to store client side user state
information while avoiding any impact due to the users web browser
configuration?
> a) information in a Properties file
> b) information available from a singleton
> c) information in HttpSessions
> d) information in Hidden tags
> e) information in the ServletContext
> f) information in Cookies
> g) information in URL rewriting
> h) information in an HttpSession

regards
[ November 19, 2003: Message edited by: HS Thomas ]
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think e and h.
Please keep poeting your questions. It helps.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rei, there are two questions in there. So two set of answers and reasons would help. This is the last question. The others are rather boring not to mention the fact that I'll start worrying that I have revealed too much.
By this time I imagine the list of questions has circled the agencies who are probably giving out the answers themselves.
I have worked for a car manufacturer before and this is one slip up that shows clueless management and lack of a sense of security. Cutting costs of bringing someone in to interview. haha.
I could have made an effort to answer the questions at length but seeing the same questions second time around has alarm bells ringing in my head.

regards
 
Steve Chernyak
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
4. b,c,d,g,e,h


new Tester(). is the enclosing class and new InnerTester() is created within it;


I guess im not clear what "in the inclosing" class meant.
A private method can only be called from within the enclosing class right?
Does "from within" and "in the enclosing class" not mean the same thing?
Thanks for the questions.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
4. Which of the following describe ways that dynamic information can be
made available to all servlet requests sent to an application configuration?
> c) information in HttpSessions
> d) information in Hidden tags
> f) information in Cookies
and which of the following can be used to store client side user state
information while avoiding any impact due to the users web browser
> c) information in HttpSessions
> e) information in the ServletContext
> g) information in URL rewriting
 
straws are for suckers. tiny ads are for attractive people.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic