Quiz
Week 5 Practice Quiz
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (15)
1Two ways of concatenating two Strings are:
- AUse the concat() method or use the + between the two Strings
- BUse the concatenate() method or use the + between the two Strings
- CUse the contenate() method or the concat() method
- DUse the concat() method or the trim() method
2What will be the value of loc after the following code is executed?
int loc;
String str = "The cow jumped over the moon.";
loc = str.indexOf("ov");- A15
- B16
- C17
- D18
3When you are writing a program with String objects that may have unwanted spaces at the beginning or end of the strings, use this method to delete them.
- Areplace
- Btrim
- CvalueOf
- Dsubstring
4When using the StringBuilder class's insert method, you can insert:
- Aany primitive type
- Ba String object
- Ca char array
- DAll of these
5The term ________ commonly is used to refer to a string that is part of another string.
- Astrand
- Bsubstring
- Ccharacter fragment
- Dnested string
6This character is one that appears at the end, or right side, of a string, after the non-space characters:
- ALeading whitespace
- BCarriage return
- CTrailing whitespace
- DLine feed
7What is the term used for the character that separates tokens?
- Atokenizer
- Bdelimiter
- Cwhitespace
- Dseparator
8What will be the tokens for the following code?
String str = "123-456-7890";
String[] tokens = str.split("-");- A123, 456, and 7890
- B-
- C123, 456, 7890, and -
- DNone of these
9A protected member of a class may be directly accessed by:
- Amethods of the same class
- Bmethods of a subclass
- Cmethods in the same package
- DAll of these
10A subclass can directly access:
- Aall members of the superclass
- Bonly public and private members of the superclass
- Conly protected and private members of the superclass
- Donly public and protected members of the superclass
11If ClassA extends ClassB, then:
- Apublic and private members of ClassB are public and private, respectively, in ClassA
- Bpublic members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA
- Cneither public or private members in ClassB can be directly accessed in ClassA
- Dprivate members in ClassB are changed to protected members in ClassA
12In an inheritance relationship:
- AThe superclass constructor always executes before the subclass constructor
- BThe subclass constructor always executes before the superclass constructor
- CThe constructor with the lowest overhead always executes first regardless of inheritance
- DThe unified constructor always executes first regardless of inheritance
13In an inheritance relationship:
- AThe superclass constructor always executes before the subclass constructor
- BThe subclass constructor always executes before the superclass constructor
- CThe constructor with the lowest overhead always executes first regardless of inheritance
- DThe unified constructor always executes first regardless of inheritance
14Like a family tree, a ________ shows the inheritance relationship between classes.
- Aflowchart
- Bclass map
- Cclass hierarchy
- Dbinary tree
15Protected members are:
- Anot quite private
- Bnot quite public
- Cboth not quite private and not quite public
- Dneither not quite private nor not quite public
Information
- Description
- CPSI 1413 Quiz on Week 5 Practice Quiz, created by Adam Peterson on 11/03/2019.
- Author
- Adam Peterson
- Language
- English
- Views
- 2
- Tags
- Rating
- No ratings yet Rate this quiz