zoukankan      html  css  js  c++  java
  • SSD3 MultipleChoice Quiz 1

    Your performance was as follows:

    1.

    Which method must exist in every Java application?   

     

    (a) begin

    (b) main

    (c) paint

    (d) init

     

    Correct answer is   (b)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.1 of the course notes.

       (b)    

     

             2.   

    The term wrapper classes refers to      

     

    (a) the Java classes that contain at least two data fields

    (b) the Java classes that contain themselves

    (c) a collection of Java classes that "wrap" Java primitive types

    (d) a collection of Java classes that contain other Java classes

     

    Correct answer is   (c)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.3 of the course notes.

       (c)     

     

             3.   

    Given the following code, what value will be output by the last statement?

     

    StringTokenizer st = new StringTokenizer("this is,a,test of tokens", ",");

    String s;

    int count = 0;

     

    while (st.hasMoreTokens())  {

          s = st.nextToken();

          ++count;

    }

    stdOut.println(count);

     

            

     

    (a) 3

    (b) 1

    (c) 6

    (d) 4

     

    Correct answer is (a)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.3 of the course notes.

       (a)    

     

             4.   

            

     

    What will be output when the following Java program segment is executed?

     

           int x = 5;

           int y = 2;

           System.out.println(x + y);

     

            

     

    (a) 5+2

    (b) 5 2

    (c) 7

    (d) 52

     

    Correct answer is   (c)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.4 of the course notes.

       (c)     

     

             5.   

            

     

    Consider the following Java program segment.

     

           int x = 5;

           int y = 2;

           System.out.println(x + "1" + y);

     

    Which of the following statements is true about the program segment?

            

     

    (a) The output caused by the code will be 512.

    (b) The output caused by the code will be 8.

    (c) The code will cause a compilation error.

    (d) The output caused by the code will be 5 1 2.

     

    Correct answer is (a)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.4 of the course notes.

       (a)    

     

             6.   

            

     

    Consider the following Java program segment.

     

        import java.io.*;

     

        public class SomeClass{

     

          public void x() {

     

               throw new RuntimeException("Exception from x");

          }

         

          public void y(){

     

               throw new IOException("Exception from y");

          }

        }

     

    Which of the following is true concerning the definitions for the methods x and y?

            

     

    (a) Neither x nor y has a legal definition.

    (b) Both x and y have legal definitions.

    (c) x has a legal definition, but y has an illegal definition.

    (d) x has an illegal definition, but y has a legal definition.

     

    Correct answer is   (c)

     

    Your score on this question is:        0.00

     

    Feedback:       

       See section 1.1.5 of the course notes.

       (b)    

     

             7.   

            

     

    In Java, exceptions that are not handled are passed up the

            

     

    (a) exception ladder

    (b) call stack

    (c) catch blocks

    (d) block hierarchy

     

    Correct answer is   (b)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.5 of the course notes.

       (b)    

     

             8.   

             What is the name of the JDK program that processes Javadoc comments?        

     

    (a) javadoc

    (b) javacom

    (c) javac

    (d) java

     

    Correct answer is (a)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.7 of the course notes.

       (a)    

     

             9.   

            

     

    According to the Java code conventions, files longer than _____ lines should be _____.

            

     

    (a) 2000, encouraged

    (b) 100, encouraged

    (c) 2000, avoided

    (d) 100, avoided

     

    Correct answer is   (c)

     

    Your score on this question is:        0.00

     

    Feedback:       

      

     

    See section 1.1.6, subsection "CodeConvTOC," in the course notes.

     

       (d)    

     

             10.

            

     

    After a typical debugger encounters a breakpoint, the programmer using the debugger may perform which of the following actions?

     

       1. Examine the values of variables in the halted program

       2. Execute the current line

       3. Resume execution of the halted program

     

            

     

    (a) III only

    (b) I, II, and III

    (c) I only

    (d) I and II only

     

    Correct answer is   (b)

     

    Your score on this question is:        0.00

     

    Feedback:       

      

     

    See section 1.1.8, subsection "The Debugger," in the course notes.

     

       (d)    

     

             1.   

    The name of a Java source file       

     

    (a) must use the extension .class

    (b) must be the same as the class it defines, respecting case

    (c) must be the same as the class it defines, ignoring case

    (d) has no restrictions

     

    Correct answer is   (b)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.1 of the course notes.

       (b)    

     

             2.   

            

     

    Which of the following is the string concatenation operator in Java?

            

     

    (a) +

    (b) ++

    (c) ^

    (d) &

     

    Correct answer is   (a)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.3 of the course notes.

     

             5.   

            

     

    A difference between the methods print and println of the class java.io.PrintWriter is that

            

     

    (a) println appends a new line to the end of its output, but print does not

    (b) print appends a new line to the end of its output, but println does not

    (c) println inserts a new line at the beginning of its output, but print does not

    (d) print inserts a new line at the beginning of its output, but println does not

     

    Correct answer is   (a)

     

    Your score on this question is:        10.00

     

    Feedback:       

       See section 1.1.4 of the course notes.

       (a)    

     

             6.   

    What is the right way to handle abnormalities in input on Java?

     

    (a) By handling these problems by providing exception handlers

    (b) By always specifying the throws clause in every method header where file I/O is performed

    (c) By using the class FileFilter which gracefully filters out bad input data

    (d) By writing while loops to guard against bad input

     

    Correct answer is   (a)

     

    Your score on this question is:        0.00

     

    Feedback:       

       See section 1.1.5 of the course notes.

       (b)    

     

             7.   

            

     

    All Java exception classes are derived from the class

            

     

    (a) java.lang.RuntimeException

    (b) java.lang.Throwable

    (c) java.lang.Error

    (d) java.io.IOException

     

    Correct answer is   (b)

     

    Your score on this question is:        0.00

     

    Feedback:       

       See section 1.1.5 of the course notes.

       (a)    

     

             9.   

            

     

    Which of the following statements is true of the conventions outlined by Sun Microsystems in the document entitled Code Conventions for the Java Programming Language?

     

       1. They define a standard interface definition language that must be used for all Java classes.

       2. They provide recommendations intended to make source code easier to read and understand.

       3. They describe one mechanism for network communication between Java and C++ programs.

     

            

     

    (a) III only

    (b) I, II, and III

    (c) II only

    (d) I and III only

     

    Correct answer is   (c)

     

    Your score on this question is:        10.00

     

    Feedback:       

      

     

    See section 1.1.6, subsection "CodeConvTOC" and section 1.1, subsection "Why Have Code Conventions," in the course notes.

     

       (c)     

     

             10.

            

     

    A tool that allows programmers to execute lines of a program one line at a time in order to help locate the source of a program's errors is known as a(n)

            

     

    (a) debugger

    (b) stack trace

    (c) exception handler

    (d) scope

     

    Correct answer is   (a)

     

    Your score on this question is:        10.00

     

    Feedback:       

      

     

    See section 1.1.8, subsection "The Debugger," in the course notes.

     

  • 相关阅读:
    简单的验证码;在一个数组中随即打印出4个不重复的字母
    数据类型
    java语法基础
    mac 开机运行脚本
    【mac】 搭建java环境
    mac 复制文件到NTFS格式的移动硬盘
    JAVA学习日报 8.19
    JAVA学习日报 8.20
    (VI)事务:Spring 事务管理
    (VI)事务:Spring 事务细节
  • 原文地址:https://www.cnblogs.com/vivizhyy/p/3394930.html
Copyright © 2011-2022 走看看