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

  • Copy the the code below into your IDE or an online compiler and test an additional...

    Copy the the code below into your IDE or an online compiler and test an additional type with the generic class. Submit your code and execution display. IN JAVA // A Simple Java program to show working of user defined // Generic classes     // We use < > to specify Parameter type class Test<T> {     // An object of type T is declared     T obj;     Test(T obj) {  this.obj = obj;  }  // constructor     public T getObject()  { return this.obj; } } //...

  • 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...

  • Why float f = 10d will cause the compiler error/ and why int and double did...

    Why float f = 10d will cause the compiler error/ and why int and double did not cause any compiler error ? public class Main { public static void main(String[] args) { // write your code here char c = 38; int i = 'a'; double d = 10f; double d2 = 10; float f = 10d; System.out.println(a + b); } }

  • 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...

  • 1. What does a Java compiler do? Select one: a. Runs Java programs b. Translates byte...

    1. What does a Java compiler do? Select one: a. Runs Java programs b. Translates byte code in ".class" files into machine language c. Translates source code in ".class" files into machine language d. Translates source code in ".java" files into Java byte code in ".class" files e. Translates source code in ".java" files into machine language 2. A subclass will _____ one superclass. Select one: a. abstract b. extend c. implement d. inherit e. override 3. Consider the following...

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