jagomart
digital resources
picture1_Programming Pdf 184187 | Finalkey


 146x       Filetype PDF       File size 0.06 MB       Source: web.ics.purdue.edu


File: Programming Pdf 184187 | Finalkey
cs180fall2006finalexam thereare30multiplechoicequestions eachoneisworth3points there are5program mingquestions worth a total of 110 points answer the multiple choice questions on the bubble sheet given and the programming questions on the exam booklet ...

icon picture PDF Filetype PDF | Posted on 01 Feb 2023 | 2 years ago
Partial capture of text on file.
                       CS180Fall2006FinalExam
              Thereare30multiplechoicequestions. Eachoneisworth3points. There are5program-
            mingquestions worth a total of 110 points.
              Answer the multiple choice questions on the bubble sheet given and the programming
            questions on the exam booklet.
              Fill in the Instructor, Course, Signature, Test, and Date blanks. For “Instructor” put your
            Recitation Instructor’s last name. For “Course” put CS 180. For “Test” put Final.
              Fill in the bubbles that correspond to your name, section and Student ID in the bubble
            sheet. For your section number, use 0830, 0930, 1030, 1130, ... – based on the start time of
            your Friday recitation. Consult the following list:
            08:30 recitation in LWSN B134: Elizabeth Blythe
            09:30 recitation in LILY G401: Matt Carlson
            10:30 recitation in LILY G424: Matt Carlson
            10:30 recitation in CIVL 1266: Alvin Law
            11:30 recitation in REC 122:   Alvin Law
            12:30 recitation in LILY G424: Isuru Ranaweera
            01:30 recitation in REC 308:   Isuru Ranaweera
            02:30 recitation in LWSN B134: Nick Sumner
            03:30 recitation in REC 226:   Nick Sumner
              Foryourstudent ID, use the 10 digit ID number on your student ID card. DO NOT USE
            YOURSOCIALSECURITYNUMBER!
              Examswithout names will be graded as zero. Only the answers on the bubble sheet will
            be counted. The questions will be discarded.
                      Recitation Start Time
                      Recitation TA’s Name
                        Student Last Name
                        Student First Name
         Part I. Multiple Choice Questions (3 points each):
         1. Which of the following characteristics of an object-oriented programming language restricts behavior
          so that an object can only perform actions that are defined for its class?
           (a) Dynamic Binding
           (b) Polymorphism
           (c) Inheritance
           (d) Encapsulation ******
         2. What is the value of the String S after the following line?
             String S = (new String("arach")).substring(0,2) +
                       (new String("nophobia")).substring(3);
           (a) "arachobia"
           (b) "arnophobia"
           (c) "arhobia" ******
           (d) "rachobia"
         3. When would you use a private constructor?
           (a) When you get bored with public
           (b) If you want to disallow instantiation of that class from outside that class ******
           (c) If you want to protect your class’s members from outside modification
           (d) Never, it’s not allowed
         4. Which of the following is true about RuntimeException and its subclasses?
           (a) If a method throws a RuntimeException, the use of the try/catch block is optional. ******
           (b) The FileIOException class is a subclass of RuntimeException.
           (c) In general, handling of RuntimeException should be done at compile time.
           (d) In general, RuntimeException must be caught with a try/catch block.
         5. Which of the following types cannot be used as the parameter for a switch statement?
           (a) char
           (b) boolean ******
           (c) byte
           (d) int
                             1
         6. What is the output when you try to compile and run the following code?
             public class Switch {
               public static void main(String[] args) {
                  int i = 1;
                  switch( i ) {
                    case 0:
                       int j = 0;
                       System.out.print( j );
                    case 1:
                       int j = 1;
                       System.out.print( j );
                    case 2:
                       int j = 2;
                       System.out.print( j );
                    default:
                       int j = -1;
                       System.out.print( j );
                  }
               }
             }
           (a) 12-1
           (b) 1
           (c) 12
           (d) The code does not compile ******
         7. What is the most specific result of the following code?
             Integer[] someInts = new Integer[100];
             int sum = 0;
             for ( Integer i : someInts )
             {
               sum += i;
             }
             System.out.println( sum / someInts.length );
           (a) 0
           (b) the sum of 100 integers
           (c) NullPointerException ******
           (d) the code will not compile
                             2
         8. What is the output of the following code segment?
             char x = ’A’;
             while(x != ’D’){
               switch(x){
                  case ’A’:
                    System.out.println(x);
                    x = ’D’;
                  case ’B’:
                    System.out.println(x);
                    x = ’C’;
                    break;
                  case ’C’:
                    System.out.println(x);
                    x = ’D’;
                  default:
                    continue;
               }
             }
           (a) A ******
             D
             C
           (b) A
             D
             C
             D
           (c) A
             D
           (d) A
         9. What are valid arguments to the instanceof operator?
           (a) a class object and a class type ******
           (b) any primitive type
           (c) boolean type only
           (d) class types only
         10. A class which implements the ActionListener interface must implement which method?
           (a) void handle( ActionEvent e )
           (b) void actionPerformed( ActionEvent e ) ******
           (c) void eventDispatched( AWTEvent e )
           (d) String getActionCommand( ActionEvent e )
                             3
The words contained in this file might help you see if this file matches what you are looking for:

...Csfallfinalexam therearemultiplechoicequestions eachoneisworthpoints there areprogram mingquestions worth a total of points answer the multiple choice questions on bubble sheet given and programming exam booklet fill in instructor course signature test date blanks for put your recitation s last name cs final bubbles that correspond to section student id number use based start time friday consult following list lwsn b elizabeth blythe lily g matt carlson civl alvin law rec isuru ranaweera nick sumner foryourstudent digit card do not yoursocialsecuritynumber examswithout names will be graded as zero only answers counted discarded ta first part i each which characteristics an object oriented language restricts behavior so can perform actions are dened its class dynamic binding polymorphism c inheritance d encapsulation what is value string after line new arach substring nophobia arachobia arnophobia arhobia rachobia when would you private constructor get bored with public if want disallow...

no reviews yet
Please Login to review.