C#.NET objective type questions and answers

1. Which of the following unary operators can be overloaded?
a. true (True)
b. false (True)
c. + (True)
d. new (False!)
e. is (False!)
Correct answers: a, b, c
Not answered
2. A derived class can stop virtual inheritance by declaring an override as
a. inherits (False!)
b. extends (False!)
c. inheritable (False!)
d. not inheritable (False!)
e. sealed (True)
Correct answers: e
Not answered
3. Which of the following keyword is used to overload user-defined types by defining static member functions?
a. op (False!)
b. opoverload (False!)
c. operator (True)
d. operatoroverload (False!)
e. udoperator (False!)
Correct answers: c
Not answered
4. Which of the following statements is correct?
a. Static methods can be a virtual method. (False!)
b. Abstract methods can be a virtual method. (False!)
c. It is necessary to override a virtual method. (False!)
d. When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overriden. (True)
e. We can override virtual as well as non-virtual methods. (False!)
Correct answers: d
Not answered
5. Which of the following statements are correct?
a. All operators in C#.NET can be overloaded. (False!)
b. We can use the new modifier to modify a nested type if the nested type is hiding another type. (True)
c. In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator. (False!)
d. Method overloading is used to create several methods with the same name that performs similar tasks on similar data types. (False!)
e. Operator overloading permits the use of symbols to represent computations for a type. (True)
Correct answers: b, e
Not answered
6. Which of the following statements is correct?
a. The conditional logical operators cannot be overloaded. (True)
b. When a binary operator is overloaded the corresponding assignment operator, if any, must be explicitly overloaded. (False!)
c. We can use the default equality operator in an overloaded implementation of the equality operator. (False!)
d. A public or nested public reference type does not overload the equality operator. (False!)
e. The array indexing operator can be overloaded. (False!)
Correct answers: a
Not answered
7. Which of the followings is the correct way to overload + operator?
a. .public sample operator + ( sample a, sample b ) (False!)
b. public abstract operator + ( sample a, sample b) (False!)
c. public abstract sample operator + (sample a, sample b ) (False!)
d. public static sample operator + ( sample a, sample b ) (True)
Correct answers: d
Not answered
8. Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member?
a. new (True)
b. base (False!)
c. overloads (False!)
d. override (False!)
e. overridable (False!)
Correct answers: a
Not answered
9. Which of the following statements is correct?
a. When used as a modifier, the new keyword explicitly hides a member inherited from a base class. (True)
b. Operator overloading works in different ways for structures and classes. (False!)
c. It is not necessary that all operator overloads are static methods of the class. (False!)
d. The cast operator can be overloaded. (False!)
Correct answers: a
Not answered
10. Which of the following are necessary for Run-time Polymorphism?
a. The overridden base method must be virtual, abstract or override. (True)
b. Both the override method and the virtual method must have the same access level modifier. (True)
c. An override declaration can change the accessibility of the virtual method. (False!)
d. An abstract inherited property cannot be overridden in a derived class. (False!)
e. An abstract method is implicitly a virtual method. (True)
Correct answers: a, b, e
Not answered
11. Which of the following operators cannot be overloaded?
a. true (False!)
b. false (False!)
c. new (True)
d. ~ (False!)
e. sizeof (True)
Correct answers: c, e
Not answered
12. Which of the following modifier is used when a virtual method is redefined by a derived class?
a. overloads (False!)
b. override (True)
c. overridable (False!)
d. virtual (False!)
e. base (False!)
Correct answers: b
Not answered
13. In order for an instance of a derived class to completely take over a class member from a base class, the base class has to declare that member as
a. new (False!)
b. base (False!)
c. virtual (True)
d. overrides (False!)
e. overloads (False!)
Correct answers: c
Not answered
14. Which of the following statements is correct?
a. Only one object can be created from an abstract class. (False!)
b. By default methods are virtual. (False!)
c. If a derived class does not provide its own version of virtual method then the one in the base class is used. (True)
d. If the method in the derived class is not preceded by override keywords, the compiler will issue a warning and the method will behave as if the override keyword were present. (False!)
e. Each derived class does not have its own version of a virtual method. (False!)
Correct answers: c
Not answered
15. Which of the following can be declared as a virtual in a class?
a. Methods (True)
b. Properties (True)
c. Events (True)
d. Fields (False!)
e. Static fields (False!)
Correct answers: a, b, c
Not answered
16. Which of the following statements is incorrect about delegate?
a. Delegates are reference types. (False!)
b. Delegates are object oriented. (False!)
c. Delegates are type-safe. (False!)
d. Delegates serve the same purpose as function pointers in C and pointers to member function operators in C++. (False!)
e. Only one method can be called using a delegate. (True)
Correct answers: e
Not answered
17. In which of the following areas are delegates commonly used?
a. Remoting (False!)
b. Serialization (False!)
c. File Input/Output (False!)
d. Multithreading (True)
e. Event handling (True)
Correct answers: d, e
Not answered
18. Which of the following is the necessary condition for implementing delegates?
a. Class declaration (True)
b. Inheritance (False!)
c. Run-time Polymorphism (False!)
d. Exceptions (False!)
e. Compile-time Polymorphism (False!)
Correct answers: a
Not answered
19. Which of the following statements are correct about the delegate declaration given below?
a. On declaring the delegate a class called del will get created. (True)
b. The signature of del need not be same as the signature of the method that we intend to call using it. (False!)
c. The del class will be derived from the MulticastDelegate class. (True)
d. The method that can be called using del should not be a static method. (False!)
e. The del class will contain a one-argument constructor and an lnvoke() method. (True)
Correct answers: a, c, e
Not answered
20. Which of the following statements are correct about a delegate?
a. Inheritance is a prerequisite for using delegates. (False!)
b. Delegates are type-safe. (True)
c. Delegates provide wrappers for function pointers. (True)
d. The declaration of a delegate must match the signature of the method that we intend to call using it. (True)
e. Functions called using delegates are always late-bound. (False!)
Correct answers: b, c, d
Not answered
   
Today's date:
Total spent time:
Total answered question:
Total unanswered question:





Post a Comment

0 Comments