Cs 142 Final Review

43 Questions | Total Attempts: 214

SettingsSettingsSettings
Please wait...
Web Application Quizzes & Trivia

CS 142 Finals Review


Questions and Answers
  • 1. 
    The programs that computer executes are called
    • A. 

      Programming languages

    • B. 

      Software

    • C. 

      Integrated development environment

    • D. 

      Browsers

  • 2. 
    The ENIAC computer was build from which components:
    • A. 

      Integrated circuits

    • B. 

      Flash memory

    • C. 

      Transistors

    • D. 

      Vacuum tubes

  • 3. 
    The Java code on the Internet and that are run by Web browsers are called:
    • A. 

      Scripts

    • B. 

      Applets

    • C. 

      Databases

    • D. 

      Style sheets

  • 4. 
    The free Java modules that perform various specific tasks and that make Java arich and portable language are called:
    • A. 

      Library packages

    • B. 

      Portlets

    • C. 

      Servlets

    • D. 

      Style sheets

  • 5. 
    Which one of the following statements is true about a Java compiler?
    • A. 

      It translates the object code into the source code.

    • B. 

      It translates the library code into the virtual machine code.

    • C. 

      It translates the source code into the virtual machine code.

    • D. 

      It translates the virtual machine code into the source code.

  • 6. 
    Which one of the following programs can execute Java class files?
    • A. 

      Assembler

    • B. 

      Linker

    • C. 

      Editor

    • D. 

      Virtual machine

  • 7. 
    Is there anything wrong with this code?System.out.print("3 + 3 =")System.out.println(3 + 3);
    • A. 

      Compile-time error

    • B. 

      Run-time error

    • C. 

      Programming error

    • D. 

      No error

  • 8. 
    Java can be used to develop rich applications for the Web that are called
    • A. 

      Operating systems

    • B. 

      Applets

    • C. 

      Libraries

    • D. 

      Cookies

  • 9. 
    A major difference between C++ and Java is that:
    • A. 

      C++ is a high-level, while Java is a low-level language

    • B. 

      C++ is designed for consumers, while Java is designed for commerce

    • C. 

      C++ is object-oriented, while Java is not

    • D. 

      C++ is not portable, while Java is portable

  • 10. 
    An example of a Java integrated development environment is:
    • A. 

      NetBeans

    • B. 

      Turbo Pascal

    • C. 

      Visual Studio .NET

    • D. 

      PHP

  • 11. 
    A Java class with the name Printer has to be saved using the source file name:
    • A. 

      Printer.java

    • B. 

      Printer.java

    • C. 

      Printer.txt

    • D. 

      Printer.java

  • 12. 
    This statement starts the declaration of a class in Java:
    • A. 

      Public static void main(String[] args)

    • B. 

      Public class Classname

    • C. 

      System.out.println("Hello, World!");

    • D. 

      Java class

  • 13. 
    This Java statement prints a blank line:
    • A. 

      Public static void main(String[] args)

    • B. 

      System.out.print();

    • C. 

      System.out.println();

    • D. 

      System.out.Println();

  • 14. 
    Which Java statement does not contain an error?
    • A. 

      System.out.print(;

    • B. 

      System.out.print()

    • C. 

      System.out.printl();

    • D. 

      System.out.printl();

  • 15. 
    In order to run Java programs on a computer, the computer needs to have softwarecalled a(n):
    • A. 

      Assembler

    • B. 

      Virtual machine

    • C. 

      Windows

    • D. 

      Debugger

  • 16. 
    The Java statement "public static void main(String[] args)" declares a :
    • A. 

      Class

    • B. 

      Variable

    • C. 

      Constant

    • D. 

      Method

  • 17. 
    What is the output of the following code snippet?System.out.print("Hello");System.out.println("Good Day!");
    • A. 

      Hello Good Day!

    • B. 

      Hello Good Day!

    • C. 

      HelloGood Day!

    • D. 

      No output due to compilation errors

  • 18. 
    What is the purpose of the following algorithm?num = 0Repeat the following steps for 100 timesinput var1if var1 > numnum = var1print num
    • A. 

      To find the highest among 100 numbers

    • B. 

      To print out the 100 numbers

    • C. 

      To find the smallest among 100 numbers

    • D. 

      To search for a particular number among 100 numbers

  • 19. 
    Consider the following pseudocode. What does it produce?Create a list of consecutive integers from two to n: (2, 3, 4, ..., n).Initially, let p equal 2.Repeat following steps until p2 is greater than n.Strike from the list all multiples of p less than or equal to n.Find the first number remaining on the list greater than p; replace p with thisnumber.
    • A. 

      All even numbers from 2 to n

    • B. 

      All Fibonacci numbers from 2 to n

    • C. 

      All prime numbers from 2 to n

    • D. 

      All factorial numbers from 2 to n

  • 20. 
    What operation is least efficient in an ArrayList?
    • A. 

      Add element to the middle of the list

    • B. 

      Linear traversal step

    • C. 

      Read element

    • D. 

      Modify element

  • 21. 
    Which data structure would best be used for keeping track of bank customerswaiting for a teller?
    • A. 

      Queue

    • B. 

      Stack

    • C. 

      List

    • D. 

      Array

  • 22. 
    What must be included in a LinkedList class node?I a reference to the next nodeII a reference to the previous nodeIII a data element
    • A. 

      I

    • B. 

      I and II

    • C. 

      III

    • D. 

      I, II, and III

  • 23. 
    Assuming that staff is a LinkedList object, what is the content and iteratorposition in the staff object?public static void main(String[] args){LinkedList staff = new LinkedList();staff.addLast("Diana");staff.addLast("Tom");staff.addLast("Harry");staff.addLast("Romeo");// | in the comments indicates the iterator positionListIterator iterator = staff.listIterator(); // |DTHRiterator.next();iterator.next();iterator.add("Juliet");iterator.add("Nina");iterator.previous();iterator.remove();…}
    • A. 

      DTJNHJ

    • B. 

      DTN|HR

    • C. 

      DT|JHR

    • D. 

      DTJ|HR

  • 24. 
    Which method in the ListIterator class cannot be called twice in a row?
    • A. 

      Previous

    • B. 

      Remove

    • C. 

      Next

    • D. 

      There is no restriction

  • 25. 
    Why is it important to understand the underlying implementations of data structuretypes?(e.g. HashSet, TreeSet, ArrayList, LinkedList, etc.)
    • A. 

      It helps you choose a better coding implementation

    • B. 

      It helps you choose a data structure with best efficiency in all operations

    • C. 

      It helps you choose a data structure with best efficiency in operations you need most

    • D. 

      Nothing, because we do not know about implementation details