Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mock Exam qs...  RSS feed

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will be the correct choice ?
[code]
<%int x=0;%>
<% x = x + 1999; %>
Set it to: <%= x %>
[code]
What should be the initial value of x to allow
compilation to succeed, and allow the output of
"Set it to: 2000"?
Ans:A <% int x = 1 %>
B <%@ int x = 1 %>
C <%! int x = 1 %>
D None of the above
I think the correct choice should be 'C'.
What do u think?
Bye,
 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well correct answer is d).since it should be.
<%!int a=1;%>(semicolon)
<%int a=1;%>(semicolon)
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if its defined <%! int x = 1;%> still the answer will be d(none of the above). Because if you have a varibale defined at the class level and also at method level with the same name and if you access in the method with out this.x it will return the local varibale.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i agree with Ramu.
regards
maulin.
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
free 1 hour java lesson
https://coderanch.com/t/695988/free-hour-java-lesson
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!