Total Pageviews

Friday, May 25, 2012

EXAM 3 COMPLETED

Your performance was as follows:

You took 4 minutes on this assessment from Fri May 25 2012 12:10:53 GMT+0530 to Fri May 25 2012 12:14:16 GMT+0530.

Total score: 100.00



1.

Consider a Java program that contains two classes, Programmer and Person. The class Programmer is a subclass of the class Person, and both classes define a method sleep. Which of the following statements will be true about the program?



(a) The method sleep of Programmer will override that of Person when the program is executed.
(b) When the method sleep of Programmer is called, the method sleep of Person will be called first.
(c) The method sleep of Person will override that of Programmer when the program is executed.
(d) The program will not compile.

Correct answer is (a)

Your score on this question is: 11.11

Feedback:


See section 3.2, subsection "Overriding Methods," in the course notes.




2.

Consider the following Java program fragment.
import java.applet.Applet;

public class Hello extends Applet {

...

}

The fragment indicates that



(a) Applet is an instance of Hello
(b) Hello is a subclass of Applet
(c) Applet is a subclass of Hello
(d) Hello is an instance of Applet

Correct answer is (b)

Your score on this question is: 11.11

Feedback:


See sections 3.1 and 3.2 in the course notes.




3.

Which of the following kinds of relationships between classes does inheritance describe?



(a) has-a
(b) uses-a
(c) produces-a
(d) is-a-kind-of

Correct answer is (d)

Your score on this question is: 11.11

Feedback:


See section 3.1 "Introduction to Inheritance" in the course notes.




4.

If class A is a subclass of class B, which of the following statements is (are) true?
All public data and methods of class B are available to class A.
All public data and methods of class A are available to class B.



(a) I only
(b) II only
(c) None
(d) I and II

Correct answer is (a)

Your score on this question is: 11.11

Feedback:


See sections 3.1 and 3.2 in the course notes.




5.

Which of the following indicates that class Dog is a subclass of class Animal?



(a) public class Dog extends Animal
(b) public class Animal extends Dog
(c) public class Dog imports Animal
(d) public class Animal imports Dog

Correct answer is (a)

Your score on this question is: 11.11

Feedback:


See sections 3.1 and 3.2 in the course notes.




6.

Which of the following is true concerning the following example class definition?
public class Hello extends Applet { ...
}
Hello is a superclass of Applet
Hello inherits from Applet
Hello is a subclass of Applet



(a) I and II only
(b) II and III only
(c) III only
(d) II only

Correct answer is (b)

Your score on this question is: 11.11

Feedback:
See sections 3.1 and 3.2 in the course notes.



7.

If the following line of code is the beginning of a class definition, then class _____ is being defined, and it is a _____ of class _____.
public class Game extends Applet



(a) Applet, superclass, Game
(b) Game, subclass, Applet
(c) Game, superclass, Applet
(d) Applet, subclass, Game

Correct answer is (b)

Your score on this question is: 11.11

Feedback:
See sections 3.1 and 3.2 in the course notes.



8.

In the following program segment, the call super(len,wid) invokes the constructor for which class?
public class CustomWindow extends MyWindow implements ActionListener

{

public CustomWindow(int len, int wid, Font ft)

{

super(len, wid);

}

}



(a) MyWindow
(b) ActionListener
(c) Font
(d) CustomWindow

Correct answer is (a)

Your score on this question is: 11.11

Feedback:


See section 3.2 "Using Inheritance" in the course notes.




9.

Which of the following Java keywords can be used to invoke a superclass constructor for the class in which it appears?



(a) super
(b) this
(c) protected
(d) extends

Correct answer is (a)

Your score on this question is: 11.11

Feedback:


See Chapter 12, page 504, in the course textbook.




Go to top of assessment.

Total score: 100.00

© Copyright 2011 iCarnegie, Inc. All rights reserved.

EXAM 2

View Assessment Result: Exam 2 Multiple-Choice




Upon compilation, the source code of a Java class MyClass will be stored in the file _____, and the corresponding byte code will be stored in the file _____.





(d)

5.00


    See sections 2.1.2 and 2.1.3 in the course notes.

   




Model elements in Java programs that share a common behavior can be grouped into categories called





(b)

5.00


   See Chapter 1, page 3, in the course textbook.

   




In addition to coding, the process of programming model involves which of the following?
  1. Evaluation and testing
  2. Defining and redefining a problem
  3. Planning a solution to a problem






(c)

5.00


    All of these are part of the programming process. See section 2.1.6 in the course notes.

   




Valid Java comments include which of the following?
  1. /* this is an /* embedded */ comment */
  2. /* this is an // embedded // comment */
  3. // this is a comment */






(b)

0.00


   See section 2.1.3, subsections "The Catfish Class," in the course notes.
   




A Java servlet can obtain an object for sending data to the client of the servlet by calling which of the following methods of HttpServletResponse?





(d)

5.00


   See section 2.1.4, subsection "The Welcome Servlet," in the course notes.

   




Which of the statements below correctly constructs an object using the following constructor?
Plane(int a, int b, int c)
{
   // code
}






(c)

5.00


   See sections 2.2.4 and 2.2.6 in the course notes. Refer to the manner in which the constructors for the HtmlPage and AlgaeColony classes are implemented.
   




Which of the following is (are) consistent with Java naming conventions regarding capitalization?
  1. int numPeople;
  2. int Counter;
  3. class serviceElevator{}






(d)

5.00


    See section 2.2.2, subsection "Mapping English Terms to Java Terms," in the course notes.

   




The following line can be the start of
public void paint(Graphics  g)






(a)

5.00


   See section 2.2.2 through 2.2.4 in the course notes.
   




In Java, variables declared in the body of a method are known as _____ variables.





(d)

5.00


   See Chapter 4, page 122, in the course textbook.

   




In Java, non-sequential execution of code is achieved by using _____ statements.





(d)

5.00


    See sections 2.3.4 and 2.3.5 in the course notes.

   




The type of the number 2.0 in Java can be





(d)

5.00


   See section 2.3.1 in the course notes.
   




A Java Virtual Machine (JVM) is





(c)

0.00


    See section 2.1.2 in the course notes.

   




How many times will the following loop execute?
int  i;
for (i = 0; i < 9; i = i + 1)
    i = 8;






(a)

5.00


   See section 2.3.5 of the course notes.
   




Assume you are given a method with a specification double numbers(); that supplies you with numbers from the user's input. You need to find the first input number from user input that is smaller than 0.5 and put it in the variable x. Which of the following can be used for that purpose?
  1. double x = numbers(); while (x <= 0.5) x = numbers();
  2. double x = 0.1; while (x >= 0.5) x = numbers();
  3. double x; for (x = numbers(); x >= 0.5; x = numbers());






(c)

5.00


   The first item sets x to the first number greater than 0.5; the second item never gets user input. See section 2.3.5 of the course notes.

   




In Java, for primitives, the assignment operator is the symbol _____ and the equality operator is the symbol _____.





(a)

5.00


    See sections 2.3.2 and 2.3.3 in the course notes.

   




Consider the following code fragment.
int m = 3;
int n = m / 2;
What is the value of n?






(c)

5.00


   Integer division truncates. See section 2.3.2 in the course notes.
   




If T represents the value true and F represents the value false, what does the following expression evaluate to?

! ( ( T || F ) && !F )






(c)

5.00


   Using the precedence of the operators and the parentheses in the expression, it can be evaluated like this:
 ! ( ( T || F ) && !F ) ! ( ( T ) && T ) ! ( T && T ) ! ( T ) F
See section 2.3.3 in the course notes.

   




In Java, the scope of a parameter of a method contains the scope of which of the following?





(c)

5.00


    See section 2.3.1 in the course notes.

   




In the class defined below
class MyClass {
    int age = 19;
    void myMethod()
    {
        int counter;
    }
}






(c)

5.00


   See section 2.3.1 of the course notes.
   




Which of the following is a method invocation that retrieves the first element from an instance of class java.util.Vector?





(a)

0.00


   See Chapter 9, page 335, in the course textbook.

   



Go to top of assessment.


Thursday, May 24, 2012

EXAM 1 COMPLETED

View Assessment Result: Exam 1 Multiple-Choice





What does "url" stand for?





(a)

5.00


  
   




In www.google.com; what does "www" stand for?





(b)

5.00


  
   




How do search engine companies like Google, Microsoft, and Yahoo make money?





(d)

5.00


  
   




What can be some unethical practices on the internet?





(c)

5.00


  
   




In the following URL, what is the name of the server? http://trestle.icarnegie.com/ssd1/course.html





(a)

5.00


  
   




HTML heading tags include which of the following?
  1. <H>
  2. <H1>
  3. <H8>






(d)

5.00


    See section 1.2.3, subsections "Headings, Horizontal Lines, and Preformatted Text," in the course notes.

   




Which of the following is a valid HTML segment that directs Web browsers to display green text?





(d)

5.00


    See section 1.2.3, subsection "Size and Color," of the course notes.

   




The <PRE> tag in HTML indicates the start of





(d)

5.00


    See section 1.2.3, subsections "Headings, Horizontal Lines, and Preformatted Text," of the course notes.

   




Which of the statements is true about the following HTML segment?
<a href="www/cnn.com">CNN news</a>






(d)

5.00


   See section 1.2.4 of the course notes.
   




Consider the following table.

Which of the following HTML sequences can be used to lay out the preceding table?






(c)

5.00


   See section 1.2.4 of the course notes.
   




Testing each element of your Web page as you add it has the effect of





(c)

5.00


   See section 1.2.6 of the course notes.
   




Which of the following path formats can be used to specify the value of the href attribute of the <a> tag?
  1. An absolute path
  2. A relative path






(a)

5.00


    See section 1.2.4 in the course notes.

   




What is the conceptual difference between logical and physical styles?





(c)

5.00


   See section 1.2.3 of the course notes.
   




Logical style tags in HTML include which of the following?
  1. <EM>
  2. <STRONG>
  3. <B>






(d)

0.00


    See section 1.2.3, subsections "Physical Styles and Logical Styles," of the course notes.

   




When a Web browser submits an HTML form to a Web server, the browser sends





(c)

5.00


   See section 1.3.3, subsection "Form Submission and Servlets," in the course notes.

   




In the name-value pairs that represent a submitted HTML form, names are separated from values by the character _____, and pairs are separated from one another by the character _____.





(d)

5.00


   See section 1.3.3, subsection "Form Submission and Servlets," in the course notes.

   




Which of the following statements is (are) true of Java servlets?
  1. They can produce dynamic responses to client requests.
  2. They are invoked directly by clients without involvement by a server.






(b)

0.00


   See section 1.3.2 in the course notes.

   




In an HTML FORM element, the values get and post are the only valid options for which of the following attributes?





(d)

5.00


   See section 1.3.1, subsection "The FORM Element," in the course notes.

   




Typically, a request from a client browser is forwarded to a servlet by a





(c)

0.00


   See section 1.3.2, subsection "An Overview of Servlets," in the course notes.

   




In the client-side mechanism client-pull, _____ are generated _____.





(b)

0.00


   See section 1.3.2, subsection "Server Push-Client Pull," in the course notes.

   



Go to top of assessment.