Shared Flashcard Set

Details

Java II
n/a
42
Computer Science
Undergraduate 3
05/14/2012

Additional Computer Science Flashcards

 


 

Cards

Term
A class describes how data and methods are encapsulated into a single object.
Definition
True
Term
From one object you can build many classes
Definition
False, from one class you can build many objects
Term
From one class you can build many objects
Definition
True
Term
Every object belongs to some class
Definition
True
Term
Every class belongs to some object
Definition
False, every object belongs to some class
Term
Different objects of the same class share the same methods
Definition
True
Term
Different objects of the same class always share the same data
Definition
False, each objects has their own data
Term
An object belongs to more than one class
Definition
True
Term
A method cannot return a reference to an object
Definition
False, method can return a reference
Term
The name of an object specifies a reference
Definition
True
Term
When an object is passed to a method, the objects data is copied into a method parameter
Definition
False
Term
Java provides a class that facilatates the formatting of floating numbers
Definition
True
Term
Java does not allow a programmer to write their own classes
Definition
False you can write as many as you want
Term
A private method of a class is accessible to every method of the class
Definition
False
Term
A public instance variable is accessible to every method in the class
Definition
True
Term
A private instance variable is accessible to any method external to the class
Definition
False, because it is private
Term
A static variable is shared by all objects of a class
Definition
True
Term
A static variable x can be accessed by an object p the same way any instance variable is accessed namely p.x
Definition
True
Term
A public static variable is accessible to any method external to the class
Definition
True
Term
A public static variable is accessible to any method external to the class
Definition
True
Term
A public static variable is accessible to any method external to the class
Definition
True
Term
A private static variable is accessible to any method external to the class
Definition
False, it is private
Term
A constructor is a special kind of method with no return type, not even void
Definition
True
Term
Constructors intialize and instantiate objects
Definition
True
Term
Only one constructor per class is permitted
Definition
False , you can have muiltple
Term
Constructors cannot be overloaded
Definition
False
Term
If you fail to define a constructor, java provides a default constructor and correctly initialize instance varialbe
Definition
false
Term
an object is garbage when it is no longer referenced
Definition
true
Term
key word THIS is a reference to the calling object
Definition
false
Term
keyword THIS is a allows a method to refer directly to the referece of the called object
Definition
False
Term
An instance variable must be built-in Java type and not a programmer designed class
Definition
False
Term

Correct:

String howAboutThat = new String('a')

Definition
'a' is a char not a string to correct "a"
Term

Correct:

 

String String = " String" ; 

Definition
String string = " String " ;
Term

Correct:

 

Random randomNum = 3;

Definition
Random randomNum = new Random (3);
Term

Correct 

 

Random x = Random ();

Definition
Random x = new Random();
Term

Correct:

 

Random y = new Random (3);

Definition
Nothing is wrong
Term

Correct

 

import Java.util;

Definition
import Java.util.*;
Term

Correct:

 

File MyFile = new File();

Definition

String x = "myfile.txt";

 

File MyFile= new File(x);

Term

File f = new File(myfile.txt);

 

Definition
File f = new File ( " myfile.txt") ;
Term

String text = "myfile.txt";

File myFile = new File ("text");

Definition
String text = "myfile.txt";File myFile = new File ( text);
Term
String y = " testme"; y +=char(33)
Definition

String y = " testme";

y +=(char)33

Term

String w = "Why me?";

int temp = w.trim.length();

Definition

String w = "Why Me?";

int temp = w.trim().length();

Supporting users have an ad free experience!