Question

Comments used to document code should: A. be used as little as possible B. be insightful...

  1. Comments used to document code should:

    A.

    be used as little as possible

    B.

    be insightful and explain what the instruction's intention is

    C.

    only be included in code that is difficult to understand

    D.

    be used to define variables whose names are not easy to understand

    E.

    not be included with the program

2 points   

QUESTION 2

  1. The main method for a Java program is defined by:

    A.

    public static main( )

    B.

    public static main(String[ ] args);

    C.

    public static main(String[ ] args)

    D.

    private static main(String[ ] args)

    E.

    none of the above

2 points   

QUESTION 3

  1. What is the result when the following line of Java code is executed:

    System.out.println("Hello");

    A.

    Do nothing

    B.

    Cause Hello to be output

    C.

    Cause a syntax error

    D.

    Cause "(Hello)" to be output

    E.

    There is no way to know without executing this line of code.

2 points   

QUESTION 4

  1. Which character below is not allowed to be used as an identifier?

    A.

    P

    B.

    x1

    C.

    0 (zero)

    D.

    q

    E.

    y2k

2 points   

QUESTION 5

  1. Which of the following would not be syntactically legal in Java?

    A.

    public class Foo

    B.

    System.out.println("Hi");

    C.

    { }

    D.

    static main(String[ ] args)

    E.

    only b is legally valid, all of the rest are illegal

2 points   

QUESTION 6

  1. Which of the following would be a legal Java identifier?

    A.

    i

    B.

    class

    C.

    ilikeclass!

    D.

    idon'tlikeclass

    E.

    I like class

2 points   

QUESTION 7

  1. A unique aspect of Java that allows code compiled on one machine to be executed on a machine of a different hardware platform is Java’s:

    A.

    bytecode

    B.

    syntax

    C.

    use of objects

    D.

    use of exception handling

    E.

    None of the above

2 points   

QUESTION 8

  1. Java is similar in syntax to what other high level language?

    A.

    Pascal

    B.

    Ada

    C.

    C++

    D.

    FORTRAM

    E.

    BASIC

2 points   

QUESTION 9

  1. Which of the following is true regarding Java syntax and logic errors?

    A.

    a Java compiler can determine if you have followed proper syntax but not proper logic

    B.

    a Java compiler can determine if you have followed proper logic but not proper syntax

    C.

    a Java compiler can determine if you have followed both proper syntax and logic

    D.

    a Java compiler cannot determine if you have followed either proper syntax or logic

    E.

    a Java compiler can determine if you have followed proper syntax and can determine if you have followed proper logic if you follow the Java naming convention rules

2 points   

QUESTION 10

  1. Of the following, which would be the best variable name for the current value of a stock?

    A.

    curval

    B.

    theCurrentValueOfThisStockIs

    C.

    currentStockVal

    D.

    csv

    E.

    current

2 points   

QUESTION 11

  1. Which of the following is a legal Java identifier?

    A.

    1ForAll

    B.

    OneForAll

    C.

    one/4/all

    D.

    1_4_all

    E.

    1forall

2 points   

QUESTION 12

  1. Which of the following characters does not need to have an associated “closing” character in a Java program?

    A.

    {

    B.

    (

    C.

    [

    D.

    =

    E.

    all of these require closing characters

2 points   

QUESTION 13

  1. Miss-typing “println” as “printn” will result in:

    A.

    no error at all

    B.

    a run-time error

    C.

    a logical error

    D.

    a syntax error

    E.

    converting the statement into a comment

2 points   

QUESTION 14

  1. The word println is a(n):

    A.

    String

    B.

    action

    C.

    variable

    D.

    class

    E.

    method

2 points   

QUESTION 15

  1. A Java variable is the name of a:

    A.

    numeric data value stored in memory

    B.

    data value stored in memory that cannot change its value during the program’s execution

    C.

    data value stored in memory that cannot change its data type during the program’s execution

    D.

    data value stored in memory that can change both its value and its type during the program’s execution

    E.

    data value or a class stored in memory that can change both its value and its type during the program’s execution

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) OPTION B IS CORRECT

2) OPTION E IS CORRECT (IT IS public static void main(String[] args))

3) OPTION B IS CORRECT

4) OPTION C

5) OPTION D

6) OPTION A

Add a comment
Know the answer?
Add Answer to:
Comments used to document code should: A. be used as little as possible B. be insightful...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java Test 1 Name 1) A Java program is best classified as arsge D) pnocesorE) aa...

    Java Test 1 Name 1) A Java program is best classified as arsge D) pnocesorE) aa 2) 6 bits can be used to represent 3) Binary numbers are composed entirely of ? 4) Define the main method for a Java program 5) Give 2 examples of a legal Java identifier? distinct items or values? 6) A unique aspect of Java that allows code compiled on one machine to be executed on a machine of a different hardware platform is Java's...

  • Somebody help my assignment! CS21, Java -Chapter 1 Quiz –MCTF Know the definitions of the following:...

    Somebody help my assignment! CS21, Java -Chapter 1 Quiz –MCTF Know the definitions of the following: •Compiler •Bytecode •Console Window •Syntax Error •Logic Error •Runtime Error Know the rules that apply to string literals Know if the name of a Java file and the name of a Java class have to be the same Know if methods other than main are allowed to call other methods Know where the flow of control goes when a method finishes executing Know what...

  • (30 points; 6 points each part) For each code fragment below, show a memory diagram that traces t...

    (30 points; 6 points each part) For each code fragment below, show a memory diagram that traces the execution of the calling method. 2. a) //main method nt data-14,7,3; method(data, 0); public static void method(int[l array, int value) for (int index array,length/2; index

  • Java 1. Can you explain it how it will be printed step by step? Thanks!! What...

    Java 1. Can you explain it how it will be printed step by step? Thanks!! What is printed by the following? for (int i=1; i<4; i++) { for (char c=’a’; c<=’c’; c++) { if (i%2==0) { i++; System.out.println(i + " " + c); } else { c++; System.out.println(c + " " + i); } } } 2. Is there a compiler error in this code? If so, what is it? If not, what’s printed? Is there a compiler error in...

  • what is wrong with my code. what should I do with this kind of error 61...

    what is wrong with my code. what should I do with this kind of error 61 QueueDemo java - Files - RaProjects/one- A Queue Demoava Queueinterface Java inport java.util.LinkedList; import java.util.Queue public class QueueDemo public static void main(String[] args) { 10 11 12 13 Queue String myQueue new LinkedlistString();//Create a reference to a queue Interface myqueue.add("A");//Call the enqueue method on myQueue passing the string value of "A" myQueue.add("B");//call the enqueue method on nyQueue passing the String value of "3" myQueue.add("C");//Call...

  • Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array...

    Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array double[10]; c. charl charArray "Computer Science"; None of the above Analyze the following code: class Test public static void main(Stringl] args) System.out.println(xMethod(10); public static int xMethod(int n) System.out.println("int"); return n; public static long xMethod(long n) System.out.,println("long"); return n The program displays int followed by 10 The program displays long followed by 10. The program does not compile. None of the above. tions 3-4 are...

  • 1.Explain why computers have both main memory and secondary storage. 2.Explain the operations carried out by...

    1.Explain why computers have both main memory and secondary storage. 2.Explain the operations carried out by the preprocessor, compiler, and linker. 3.Explain what is stored in a source file, an object file, and an executable file. 4.What is an algorithm? 5.Describe difference between program line and a statement. 6.Is a syntax error found by the compiler or when the program is running? 7.What two units does the CPU consist of? 8.What happens to a variable’s current contents when a new...

  • The files provided in the code editor to the right contain syntax and/or logic errors. In...

    The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. // DebugFive2.java // Decides if two numbers are evenly divisible import java.util.Scanner; public class DebugFive2 { public static void main(String args[]) { int num; int num2; Scanner input = new Scanner(System.in); System.out.print("Enter a number "); num = input.nextInteger() System.out.print("Enter another number ");...

  • What will be the output of the following Java code? class Output { public static void...

    What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } } a) 0 b) 1 c) false d) true

  • Language is Java. Thank you.It is a review test and I will find out the rest...

    Language is Java. Thank you.It is a review test and I will find out the rest if I just know that answers. 1) What is the output of the following code: public class Test public static void main(String] args) [ String s1 new String("Java String s2 new String("Java) System.out.print( (s1 s2)(s1.equals (s2))) A) false false B) true true C) false true D) true false E) None of the above 2) Given the following program: public class Test f public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT