Preview

Java Chapter 2 Quiz

Powerful Essays
Open Document
Open Document
2047 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Java Chapter 2 Quiz
Gaddis – Starting Out With Java 5 – From Control Structures to Objects
Chapter 02 – Java Fundamentals

Multiple Choice

1. To compile a program named, First, use the following command
a. java-source 1.5 First.java
b. javac-source 1.5 First
c. javac First.java
d. compile First.javac

ANS: C

2. A Java program must have at least one
a. Class definition
b. Variable
c. Comment
d. System.out.println(); statement

ANS: A

3. All Java lines of code end with semicolons.
a. True
b. False

ANS: A

4. The ____ is normally considered the standard output and standard input devices, and usually refer to the monitor and keyboard.
a. CRT
b. CPU
c. secondary storage devices
d. console

ANS: D

5. If the following Java statements are executed, what will be displayed
System.out.println(“The top three winners are\n”);
System.out.print(“Jody, the Giant\n”);
System.out.print(“Buffy, the Dwarf”);
System.out.println(“Adelle, the Albino”);

a. The top three winners are
Jody, the Giant
Buffy, the Dwarf
Adelle, the Albino
b. The top three winners are
Jody, the Giant\nBuffy, the DwarfAdelle, the Albino
c. The top three winners are Jody, the Giant\nBuffy, the DwarfAdelle, and the Albino
d. The top three winners are
Jody, the Giant
Buffy, the DwarfAdelle, the Albino

ANS: D

6. A(n) ____ is a value that is written into the code of a program.
a. literal
b. assignment statement
c. variable
d. operator

ANS: A

7. What would be printed out as a result of the following code?
System.out.println(“The quick brown fox”
+ “jumped over the \n”
“slow moving hen.”);

a. The quick brown fox jumped over the \nslow moving hen.
b. The quick brown fox jumped over the slow moving hen.
c. The quick brown fox jumped over the slow moving hen.
d. Nothing. This is an error.

ANS: D

8. Which of the following is not a rule that must be followed when naming identifiers?
a. The first character must be one of the letters a–z, A–Z, and underscore or a dollar sign.
b. Identifiers can contain spaces.
c. Uppercase and

You May Also Find These Documents Helpful

  • Satisfactory Essays

    1. Substances capable of triggering the adaptive immune system and provoking an immune response are called antigens.…

    • 483 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Proj586 - Week 2 Quiz

    • 932 Words
    • 4 Pages

    (TCO A) Which step of the project life cycle produces all of the project deliverables?…

    • 932 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    c. A device that works with binary data is called a DIGITAL device. (pg. 11)…

    • 388 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Quiz 1

    • 683 Words
    • 3 Pages

    Fred and Ginger are general partners in a business. They decide to purchase a building for the partnership. Ginger will put up the money for the building, and Fred will complete the remodeling. While inspecting the building, Fred is informed that the building is packed full of asbestos. He fails to tell Ginger of the presence of the substance. They buy the building and go into business. During the remodeling of the building, people from the neighborhood begin complaining about the dust from the building. Some of them even threaten to sue. Who is liable?…

    • 683 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    HS111_Unit4_Template

    • 1016 Words
    • 8 Pages

    Section 1: Enter the prefix for the provided definition. You must also correctly place the hyphen in order to receive full credit.…

    • 1016 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    C. They directly describe the characteristics of…

    • 1096 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    Nt1310 Unit 8 Study Guide

    • 546 Words
    • 3 Pages

    Activity Activity Activity Activity Activity Activity 8 - IntroIntro IntroIntroduction tduction tduction t duction t duction tduction t o Programming Programming Programming Programming Programming Programming Programming…

    • 546 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    The convention is to always use a letter of the alphabet. The dollar sign and the underscore are discouraged.…

    • 368 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Sample Exam 1 Questions

    • 973 Words
    • 4 Pages

    3. Christopher's lunch contains 121 grams of carbohydrate, 40 grams of protein, and 25 grams of fat. What percent of kilocalories in this meal come from fat?…

    • 973 Words
    • 4 Pages
    Good Essays
  • Good Essays

    only 20 to 25 percent of child-care settings in the United States provide a level of care sufficient to promote healthy psychological development.…

    • 2104 Words
    • 9 Pages
    Good Essays
  • Powerful Essays

    4. Assume the variables result, w,x, y, and z are all integers, and that w= 5, x= 4, y=8 and z=2. What will the values be stored in result in each of the following statements?…

    • 748 Words
    • 3 Pages
    Powerful Essays
  • Powerful Essays

    Itm Chapter 1 Quiz

    • 8940 Words
    • 36 Pages

    Exam Name___________________________________ TRUE/FALSE. Write 'T' if the statement is true and 'F' if the statement is false. 1) Internet advertising is growing at a rate of more than 25 percent a year. Answer: True False 2) Netbooks are emerging as a growing presence in the PC marketplace, often using open-source software. Answer: True False 3) Cloud computing platform is a flexible collection of computers on the Internet designed to perform tasks traditionally performed on corporate computers. Answer: True False 4) Digital firms sense and respond to their environments far more rapidly than traditional firms, giving them more flexibility to survive in turbulent times. Answer: True False 5) Information technology (IT) can be defined technically as a set of interrelated components that collect, process, store, and distribute information to support decision making and control in an organization. Answer: True False 6) Private intranets extended to authorized users outside the organization are called intranets. Answer: True False 7) The World Wide Web is the exact same thing as the Internet. Answer: True False 8) As managers, most students will work for firms that are intensively using information systems and making large investments in information technology. Answer: True False 9) Cell phones, BlackBerrys, iPhones, e-mail, and online conferencing over the Internet have not yet become essential tools of business. Answer: True False 10) Supply chains have become more fast paced, with companies of all sizes depending on just-in-time inventory to reduce their overhead costs and get to market faster. Answer: True False 11) New industries appear, old ones decline, and successful firms are those that learn how to use the new technologies. Answer: True False 12) Less powerful data analytics and interactive dashboards provide real-time performance information to managers to enhance management control and decision making. Answer: True False 13) Managers adopt millions of…

    • 8940 Words
    • 36 Pages
    Powerful Essays
  • Good Essays

    Chapter 4 Quiz

    • 566 Words
    • 3 Pages

    In the goal model of STAMPS, stating that you will graduate from college in May of 2012 refers to the _____ aspect of STAMPS.…

    • 566 Words
    • 3 Pages
    Good Essays
  • Good Essays

    HS111 Unit4 Template C

    • 1066 Words
    • 8 Pages

    Section 1: Enter the prefix for the provided definition. You must also correctly place the hyphen in order to receive full credit.…

    • 1066 Words
    • 8 Pages
    Good Essays
  • Good Essays

    Pets in Great Britain

    • 307 Words
    • 2 Pages

    The English people like animals very much. Pet: dogs, cats, horses, ducks, canaries, chickens and other friends of men have a much better life in Britain, than anywhere else. In Britain they have special dog shops, selling food, clothes and other things for dogs.…

    • 307 Words
    • 2 Pages
    Good Essays

Related Topics