Written Answers and Marks 
11.List TWO code conventions associated with comments.
Marks: 2.0
ANS:
12.List ONE code convention related to indentation.
Marks: 1.0
ANS:
Marks: 4.0
ANSWER
14.Identify FOUR errors in the above application.
Marks: 4.0
ANSWER

meka apita dunne Online Quiz ekak widiyata pc eken karana
so ekama copy karala damma 

11.List TWO code conventions associated with comments.
Marks: 2.0
ANS:
- A comment block should be included before each class and method(except main method).
- Comments should not reiterate what is clear from the code.
- An introductory comment should begin a program.
12.List ONE code convention related to indentation.
Marks: 1.0
ANS:
- Statements in a method should be indented.
- 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.
Marks: 4.0
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.");
}
}
- Date is missing in the comment block.
- Class name should be a noun.
- The opening brace bracket ({) of main method should line up with the closing brace bracket (}).
- System.out.println("Internet Rules\n"); should line up with the rest of System.out.println.
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.");
}
}
14.Identify FOUR errors in the above application.
Marks: 4.0
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.");
}
}
ANSWER
- The comment block should be closed with */ but not /*.
- A brace bracket is missing after the class declaration.
- A ; is missing at the end of System.out.println("2. Do not download any files.")
- "system" should be typed as "System"
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.");
}
}

meka apita dunne Online Quiz ekak widiyata pc eken karana
so ekama copy karala damma 
Last edited:



