• 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

Label, Continue, Break Mock Question

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are two mock questions for you.



1). Given:

What is the result?

a). 010123
b). 001123
c). 012013
d). 01Nine0123
e). 0120134Nine56789
f). 0120134Nine


2). Given:

What is the result?

a). Does not compile.

b). Processing
0Before Continue
Processing
1Before Continue
Processing
2Before Continue
Processing
3Before Break
Some More Processing
Processing
4Before Continue

c). Processing
0Before Break
Processing
1Before Break
Processing
2Before Break
Processing
3Before Continue
Some More Processing
Processing
4Before Break

d). Processing
0Before Continue
Some More Processing
Processing
1Before Continue
Some More Processing
Processing
2Before Continue
Some More Processing
Processing
3Before Break
Processing
4Before Continue
Some More Processing


e). An Exception is thrown.




Good Luck

Mark
[ January 17, 2005: Message edited by: Mark Spritzler ]
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark:

Were these questions not supposed to be indented? That's cruel.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aww man, me of all people not using the CODE tags.

Just Shoot me.

Mark
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the answer for the first one is "c" i.e. it prints 012013.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,

I liked your mock Qs. especially the second question was very much twisted. Referring to this question can body explain why
doesn't execute the for loop(coded below) again and again forming an infinite loop

Can any body comment on this issue.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Can anybody comment on this issue."

It's because the continue is taking you to the ++k and the condition k < 5 is then tried.
[ January 18, 2005: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
continue does not reset the loop variable.
It will just stop the current iteration and continue with the next one.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just check the max matching executions and use method of elimination for the first answer
 
reply
    Bookmark Topic Watch Topic
  • New Topic