• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Label, Continue, Break Mock Question

 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Mark:

Were these questions not supposed to be indented? That's cruel.
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
just check the max matching executions and use method of elimination for the first answer
 
Trust God, but always tether your camel... to this tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic