Saturday, September 10, 2011

.Net Fundamentals 20(Test 2)

1) A local variable:
A. Can be used anywhere in the program
B. Is declared within a method
C. Must accept a class
D. Represents a class object

Ans: B

2) An instance variable:
A. Is an object of class
B. Represents an attribute of an object
C. is a method of a class
D. A and C

Ans: B

3) An instance method
A. Represents the behavior of an object
B. Represents the attribute of an object
C. Represents another class
D. A and B

Ans: A

4) A constructor
A. Is used to create objects
B. must have the same name as the class it is declared with
C. May be overloaded
D. All of the above

Ans: D

5) class Test: Form()
A. Creates the class Test:Form
B. Creates the class Test that inherits the class Form
C. Creates the class form that inherits the class Test
D. A and B

Ans: B

6) Defining two method with the same name but with different parameters is called:
A. Loading
B. Overloading
C. Multiplexing
D. Duplexing

Ans: B

7) In order for a class to use an interface it must:
A. inherit the properties of the interface
B. Contain the same method as the interface
C. Create an interface objects
D. All of the above

Ans: All of the above

8) Every class directly or indirectly extends the ...... class
A. System
B. Object
C. Drawing
D. Console

Ans: B

9) The concept of composition specifies that you can
A. Compose good code with c#
B. Compose C# projects with different objects
C. Reduce errors by remaining composed during programming
D. All of the above

Ans: B
--
Def: Object composition is a way to combine simple objects or data types into more complex ones
--

10) Polymorphism occurs when the methods of child class
A. Override the parent class methods but maintain the implementation
B. Maintain the same return type and arguments as the parent class but implement it differently
C. Have different return types and arguments than the parent class
D. Are virtual

Ans: B

11) To output the value of multidimensional array, console.Writeline(...)
A. myArray[1][3]
B. myArray[1,3]
C. myArray(1)(3)
D. myArray(1),(3)

Ans: A

12) All methods in an abstract class must be declared abstract
A. True
B. False

Ans: B

13) Methods that are declared abstract in the base class must show implementation at the time of declaration.
A. True
B. False

Ans: B

14) The code public class B: A{}
A. Defines a class that inherits all the methods of A
B. Defines a class that inherits the public and protected methods of A only
C. Error
D. A and B

Ans: B

15) Assuming that public class B:A{public B(int i):base(i){}} compiles and runs correctly, what can we conclude about the constructor in the class A?
A. One constructor takes an argument of type i
B. There is only a default constructor
C. One constructor takes an arguments of the type int
D. A and B

16) Classes declared with the sealed keyword cannot be base class
A. True
B. False

Ans: A

17) An abstract class
A. May contains instance variables
B. May contain constructor
C. May extend another class
D. All of the above

Ans: D

18) Class String and the char structure found in the:
A. System.String namespace
B. System.Text namespace
C. System.Chars namespace
D. System namespace

Ans: D

19) The proper way to convert a string to all lowercase is:
A. String = string.ToLower(string)
B. ToLower(string)
C. string.ToLower()
D. string.ToLower(string)

Ans: C

20) If an indexof Any methods is passed an array of characters it:
A. Finds the first occurrence of each letter in the string
B. Searches for the first occurrence of any of the characters in the string
C. will search for the first occurrence of the sequence of characters
D. generates an error

Ans: B

No comments:

Post a Comment