Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Offical Java Thread
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="h_abeysinghe" data-source="post: 10059891" data-attributes="member: 123721"><p><span style="color: Blue"><strong><span style="color: Black">Written Answers and Marks <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /></span></strong></span></p><p><span style="color: Blue"><strong></strong></span></p><p><span style="color: Blue"><strong>11.</strong><strong>List <strong>TWO </strong>code conventions associated with <em>comments</em>.</strong></span></p><p><span style="color: Blue"><strong>Marks: 2.0</strong></span></p><p> <span style="color: Blue"><strong>ANS:</strong></span></p><p></p><ol> <li data-xf-list-type="ol"><span style="color: Red">A comment block should be included before each class and method(except main method).</span></li> <li data-xf-list-type="ol"><span style="color: Red">Comments should not reiterate what is clear from the code.</span></li> <li data-xf-list-type="ol"><span style="color: Red">An introductory comment should begin a program.</span></li> </ol><p></p><p><span style="color: Blue"><strong>12.List <strong>ONE </strong>code convention related to <em>indentation</em>.</strong></span></p><p><span style="color: Blue"><strong>Marks: 1.0 </strong></span></p><p><span style="color: Blue"><strong>ANS</strong></span>: </p><ol> <li data-xf-list-type="ol"><span style="color: Red">Statements in a method should be indented.</span></li> <li data-xf-list-type="ol"><span style="color: Red">An open curly brace(bracket, { ) should be placed on the same line as the class or method declaration, and the closing curly brace (}) should be on a separate line and aligned with the class or method declaration.</span></li> </ol><p><span style="color: Blue"><strong>13.Identify <strong>FOUR</strong> violations of Code Conventions in the above application.</strong></span></p><p><span style="color: Blue"><strong>Marks: 4.0 </strong></span></p><p>[CODE]</p><p>/**</p><p> * PrintInternetRules.java</p><p> * Name: WongPuter</p><p> * Description: Displays student rules for accessing the Internet.</p><p>/*</p><p></p><p>public class PrintInternetRules</p><p> public static void main(String[] args) {</p><p> System.out.println("Internet Rules\n");</p><p> System.out.println("1. Use school issued login and password.");</p><p> System.out.println("2. Do not download any files.")</p><p> system.out.println("3. Do not reveal personal information.");</p><p> }</p><p>}</p><p>[/CODE]<strong><span style="color: Blue">ANSWER</span></strong></p><p><strong></strong></p><ol> <li data-xf-list-type="ol"><span style="color: Red">Date is missing in the comment block.</span></li> <li data-xf-list-type="ol"><span style="color: Red">Class name should be a noun.</span></li> <li data-xf-list-type="ol"><span style="color: Red">The opening brace bracket ({) of main method should line up with the closing brace bracket (}).</span></li> <li data-xf-list-type="ol"><span style="color: Red">System.out.println("Internet Rules\n"); should line up with the rest of System.out.println.</span></li> </ol><p><span style="color: Blue"><strong>Correction:</strong></span></p><p>[CODE]</p><p></p><p> /**</p><p> * PrintInternetRules.java</p><p> * Name: WongPuter</p><p> *[COLOR=Red] Date: Feb 18, 2011[/COLOR]</p><p> * Description: Displays student rules for accessing the Internet.</p><p>*/</p><p></p><p>public class [COLOR=Red]InternetRules[/COLOR]</p><p> public static void main(String[] args) </p><p>[COLOR=Red] {[/COLOR]</p><p> [COLOR=Red]System.out.println("Internet Rules\n");[/COLOR]</p><p> System.out.println("1. Use school issued login and password.");</p><p> System.out.println("2. Do not download any files.")</p><p> system.out.println("3. Do not reveal personal information.");</p><p> }</p><p>}</p><p>[/CODE]<span style="color: Blue"><strong></strong></span></p><p><span style="color: Blue"><strong></strong></span></p><p><span style="color: Blue"><strong>14.Identify <strong>FOUR</strong> errors in the above application.</strong></span></p><p><span style="color: Blue"><strong>Marks: 4.0 </strong></span></p><p>[CODE]</p><p>/**</p><p> * PrintInternetRules.java</p><p> * Description: Displays student rules for accessing the Internet.</p><p>/*</p><p></p><p>public class PrintInternetRules</p><p> public static void main(String[] args) {</p><p> System.out.println("Internet Rules\n");</p><p> System.out.println("1. Use school issued login and password.");</p><p> System.out.println("2. Do not download any files.")</p><p> system.out.println("3. Do not reveal personal information.");</p><p> }</p><p>}[/CODE]<strong></strong></p><p><strong>ANSWER</strong></p><p></p><ol> <li data-xf-list-type="ol"><span style="color: Red">The comment block should be closed with */ but not /*.</span></li> <li data-xf-list-type="ol"><span style="color: Red">A brace bracket is missing after the class declaration.</span></li> <li data-xf-list-type="ol"><span style="color: Red">A ; is missing at the end of System.out.println("2. Do not download any files.")</span></li> <li data-xf-list-type="ol"><span style="color: Red">"system" should be typed as "System"</span></li> </ol><p><strong>Correction:</strong></p><p>[CODE]</p><p>/**</p><p> * PrintInternetRules.java</p><p> * Description: Displays student rules for accessing the Internet.</p><p>[COLOR=Red] */[/COLOR]</p><p></p><p>public class PrintInternetRules</p><p>[COLOR=Red]{[/COLOR]</p><p> public static void main(String[] args) {</p><p> System.out.println("Internet Rules\n");</p><p> System.out.println("1. Use school issued login and password.");</p><p> System.out.println("2. Do not download any files.")[COLOR=Red];[/COLOR]</p><p> [COLOR=Red]S[/COLOR]ystem.out.println("3. Do not reveal personal information.");</p><p> }</p><p>}</p><p>[/CODE]<img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /></p><p>meka apita dunne Online Quiz ekak widiyata pc eken karana <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /> so ekama copy karala damma <img src="/styles/default/xenforo/smilies/default/wink.gif" class="smilie" loading="lazy" alt=";)" title="Wink ;)" data-shortname=";)" /></p></blockquote><p></p>
[QUOTE="h_abeysinghe, post: 10059891, member: 123721"] [COLOR=Blue][B][COLOR=Black]Written Answers and Marks :D[/COLOR] 11.[/B][B]List [B]TWO [/B]code conventions associated with [I]comments[/I]. Marks: 2.0[/B][/COLOR] [COLOR=Blue][B]ANS:[/B][/COLOR] [LIST=1] [*][COLOR=Red]A comment block should be included before each class and method(except main method).[/COLOR] [*][COLOR=Red]Comments should not reiterate what is clear from the code.[/COLOR] [*][COLOR=Red]An introductory comment should begin a program.[/COLOR] [/LIST] [COLOR=Blue][B]12.List [B]ONE [/B]code convention related to [I]indentation[/I]. Marks: 1.0 [/B][/COLOR] [COLOR=Blue][B]ANS[/B][/COLOR]: [LIST=1] [*][COLOR=Red]Statements in a method should be indented.[/COLOR] [*][COLOR=Red]An open curly brace(bracket, { ) should be placed on the same line as the class or method declaration, and the closing curly brace (}) should be on a separate line and aligned with the class or method declaration.[/COLOR] [/LIST] [COLOR=Blue][B]13.Identify [B]FOUR[/B] violations of Code Conventions in the above application. Marks: 4.0 [/B][/COLOR] [CODE] /** * PrintInternetRules.java * Name: WongPuter * Description: Displays student rules for accessing the Internet. /* public class PrintInternetRules public static void main(String[] args) { System.out.println("Internet Rules\n"); System.out.println("1. Use school issued login and password."); System.out.println("2. Do not download any files.") system.out.println("3. Do not reveal personal information."); } } [/CODE][B][COLOR=Blue]ANSWER[/COLOR] [/B] [LIST=1] [*][COLOR=Red]Date is missing in the comment block.[/COLOR] [*][COLOR=Red]Class name should be a noun.[/COLOR] [*][COLOR=Red]The opening brace bracket ({) of main method should line up with the closing brace bracket (}).[/COLOR] [*][COLOR=Red]System.out.println("Internet Rules\n"); should line up with the rest of System.out.println.[/COLOR] [/LIST] [COLOR=Blue][B]Correction:[/B][/COLOR] [CODE] /** * PrintInternetRules.java * Name: WongPuter *[COLOR=Red] Date: Feb 18, 2011[/COLOR] * Description: Displays student rules for accessing the Internet. */ public class [COLOR=Red]InternetRules[/COLOR] public static void main(String[] args) [COLOR=Red] {[/COLOR] [COLOR=Red]System.out.println("Internet Rules\n");[/COLOR] System.out.println("1. Use school issued login and password."); System.out.println("2. Do not download any files.") system.out.println("3. Do not reveal personal information."); } } [/CODE][COLOR=Blue][B] 14.Identify [B]FOUR[/B] errors in the above application. Marks: 4.0 [/B][/COLOR] [CODE] /** * PrintInternetRules.java * Description: Displays student rules for accessing the Internet. /* public class PrintInternetRules public static void main(String[] args) { System.out.println("Internet Rules\n"); System.out.println("1. Use school issued login and password."); System.out.println("2. Do not download any files.") system.out.println("3. Do not reveal personal information."); } }[/CODE][B] ANSWER[/B] [LIST=1] [*][COLOR=Red]The comment block should be closed with */ but not /*.[/COLOR] [*][COLOR=Red]A brace bracket is missing after the class declaration.[/COLOR] [*][COLOR=Red]A ; is missing at the end of System.out.println("2. Do not download any files.")[/COLOR] [*][COLOR=Red]"system" should be typed as "System"[/COLOR] [/LIST] [B]Correction:[/B] [CODE] /** * PrintInternetRules.java * Description: Displays student rules for accessing the Internet. [COLOR=Red] */[/COLOR] public class PrintInternetRules [COLOR=Red]{[/COLOR] public static void main(String[] args) { System.out.println("Internet Rules\n"); System.out.println("1. Use school issued login and password."); System.out.println("2. Do not download any files.")[COLOR=Red];[/COLOR] [COLOR=Red]S[/COLOR]ystem.out.println("3. Do not reveal personal information."); } } [/CODE]:D meka apita dunne Online Quiz ekak widiyata pc eken karana :D so ekama copy karala damma ;) [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom