Professional Documents
Culture Documents
Parameters passed as out parameters has to be initialized before passing them to a method.
To catch any possible exception, we can use a catch block that omit the parameters data
type and just write catch.
When calling an instance member method, we are not required to pass the this reference
explicitly to it.
Indexers cannot be overloaded, and there are should be no more than one indexer in the
class.
An instance object of a class can have more than one object reference.
Indexers are always instance members; hence, an indexer cannot be declared static.
In C#, all objects are created from classes and passed to methods by reference.
In a(an) _________ relationship, an object of a derived class also can be treated as an object
of its base class.
Encapsulation
Polymorphism
Inheritance
Interface
this reference
parent reference
sub reference
Private
Public
Protected
All mentioned
Encapsulation
Polymorphism
Inheritance
Interface
To pass an instance of the current object to a certain method to process it, we pass the
______ to this method.
This reference
The indexer
None of mentioned
Overloading
Overriding
None of all
Compile-time
Run-time
Analysis-time
None of all
Exception handling
Error codes
None of all
_______ are blueprint or templates which are used to create objects, where these objects
can be passed by reference to methods.
Classes
Interfaces
Structures
All mentioned
Defining a variable using _______ access modifier enables using it from other classes.
Private
Public
Protected
All mentioned
In OOP, _______ enables the reuse of the properties and methods of preexisting classes.
With the ability to add and modify them.
Encapsulation
Polymorphism
Inheritance
Interface
______ assume the ability to use the same method name with different implementations in
the same class, but with different method signature.
Method overloading
Method overriding
Polymorphism
Abstraction
Sealed
Override
Abstract
Closed
The ______ keyword is used to change the data and behavior inherited from a base class by
replacing a suitable member of a base class with the new derived member.
New
Base
Overloads
Override
Method overloading
Method overriding
Polymorphism
Abstraction
Virtual method
Methods only
Properties
Private
Publc
IN C#,
System.class
Sysem.Object
System
System.failure
To be able to create objects of a class from another class, its constructor has to be declared
as ______
Public
Private
Protected
All mentioned
In C#, instance variables can be accessed rom both instance methods and static methods.
We have to declare a class as abstract when at least one of the methods in the class is
virtual.
Static members can be accessed using class name rather than through a particular object.
Its class
None of all
Stop
Sealed
Closed
Override
An indexer does not have a name. In place of the name is the keyword _______ and its
parameter are declared between square brackets, and there must be at least one parameter
declaration in the parameter list.
Indexer
this
index
none
__________ is an event that causes suspension of normal application execution.
Error code
Exception
Exception handler
None of all
In OOP, the use of inheritance supports the ______ polymorphism as inherited classes can
be seen as instance of itself or of its parent classes.
Ad-hoc
Parametric
Subtype
None of all
Static members obviously don’t have access to the _____ object reference.
this
base
none of all
Identity
Behavior
State
All mentioned
_______ is the OOP concept for packaging the code and data in to a single unit to protect
data.
Encapsulation
Polymorphism
Inheritance
Interface
ref
out
value
none of all
_______ is the base class for any type of exception class in C# exception types.
Handler.Exception
System.Exception
System.Error
None of all
System.Interface
System.Class
System.Object
None
1. In line#15, suppose the user enter 1000 and 200 for the values of salary and tax respectively. The output of the
executing Line#15 will be ________
1000:200
1000:800
800:200
Other
2. After executing Line#16, the output will be ______
1000:0.2
1000:800
1000:999.8
Other
3. After executing Line#17, the output will be ______
2
1
0
Other
4. If we replace the statement that resides in Line#17 with Console.WriteLine(p2.n); the output will be _______
2
1
0
Other
5. After executing Line#18, the output will be ______
First is greater
Second is greater
Equals
Other
6. If we replace the statement that resides in Line#18 with Console.WriteLine(p1.Compare(p2)); the output will be
_______
1
-1
0
Other
7. If we replace the statement that resides in Line#18 with Console.WriteLine(p1==p2); the output will be _______
1
0
true
false
8. If we add the following statement inside Main method p2.salary=2000, p2.tax=5000; the statement p2.Print() will
display ________
2000:500
1500:500
2000:1500
Other
9. If we add the following statement inside Main method Emp.salary=2000, p2.tax=5000; the statement p2.Print()
will display ________
2000:500
1500:500
2000:1500
Other
For the following code segment:
1. namespace CApplication
2. {
3. class Sample
4. {
5. int i;
6. int j;
7. public void SetData(int i, int j)
8. {
9. i = i;
10. j = j;
11. }
12. public void Display()
13. {
14. Console.WriteLine(i + " " + j);
15. }
16. }
17. class MyProgram
18. {
19. static void Main()
20. {
21. Sample s1 = new Sample();
22. s1.SetData(10, 5);
23. s1.Display();
24. }
25. }
26. }
00
10 5
0 10
5 10
If we change Line#9 to be this.i=i; the correct output for the given code will be _____
00
10 5
0 10
5 10
If we change Line#9 to be i=this.i; the correct output for the given code will be _____
00
10 5
0 10
5 10
1. Declare a class member as --- ----, means that this member is available to classes that are
within the same assembly and derived from specified base class.
2. ---- ----- means having two or more methods with the same name but with different
signature.
3. Try{}… catch{} .. construct can be used to …… ….
4. --- ---, --- - and -- ---- are the three primary characteristics of OOP.
5. In OOP, methods, properties, constructors declared with --- --- access modifier get
access or visible only to all members of classes and projects.
6. In OOP, --- ---- are considered instances of -- ----.
7. The … …. Keyword is used to create instances of the class.
8. In OOP, --- -----,--- ---,--- --- are three characteristics of each object.
9. -- --- are blueprints of templates which are used to create objects.
10. In C#, objects created from classes are passed to methods by -----------, while primitive
data types are passed by ----------
11. –--------- class is at the top of .NET hierarchy, so it is a parent of all C# classes.
12. A ---------- class-level variable is only available to any sub-class derived from base class.
13. We can sort the elements of the array in descending order by calling the ------------
method and then the ------------ method from the System.Array class.
14. -------------- is the representation of only the essential features of an object and hiding
unessential features of an object.
15. ---------------- is the OOP technique for packaging the code and data into a single unit to
protect the data from the outside world.
16. ------------ is the characteristic of being able to assign a different meaning specifically, to
allow an entity such as a variable, a function, or an object to have more than one form.
17. In OOP, ------------- are considered instances of -------------, where a ------------ defines
properties and behavior for multiple instantiations.
18. In OOP, both data and operations on data are brought together into a single entity
called --------------.
19. -------------------is the process of creating an object whose implementation details are
hidden, however the object is used through a well-defined interface.
20. In OOP, ------------- enables the reuse of the properties and methods of preexisting
classes. With the ability to add and modify them.
21. -- -- of a certain class is a constructor that receives a single argument; this argument is a
reference of an object of this class.
22. OOP languages provide the ad-hoc polymorphism using -- --.
23. In C#, all object inherits from the –------ class, and all arrays inherit from the –------- class.
24. Object of references are created in the –---- memory, while their references are created
in the –------- memory.
25. We use the method -------- to get the number of rows in a 2-dimensional array object.
26. Defining a variable using –------- access modifier enables using it from other classes.
27. A write-only property has only -- -- block in its definition.
28. In C#, objects created from classes are passed to methods by reference, while primitive
data types are passed by value
29. –Object-- class is at the top of .NET hierarchy, so it is a parent of all C# classes.
30. A protected class-level variable is only available to any sub-class derived from base class.
31. The keyword Sealed can be used to prevent a class from being inherited.
32. A(n) abstract class is a class that cannot be instantiated.
33. A(n) Interface is essentially a blueprint for a class without any implementation.
34. Abstraction is the representation of only the essential features of an object and hiding
unessential features of an object.
35. Encapsulation is the OOP technique for packaging the code and data into a single unit
to protect the data from the outside world.
36. Polymorphism is the characteristic of being able to assign a different meaning
specifically, to allow an entity such as a variable, a function, or an object to have more
than one form.
37. Interfaces are definitions of operations applicable externally to an object.
38. The --abstract--- class cannot be used to create objects, while --sealed-- class cannot be
inherited.
39. Data Abstraction is the process of creating an object whose implementation details are
hidden, however the object is used through a well-defined interface.
40. --ADT(abstract data type)-- are objects whose implementations is encapsulated.
41. In OOP, --Inheritance-- enables the reuse of the properties and methods of preexisting
classes. With the ability to add and modify them.
42. The three common forms of polymorphism in OOP are –subtype--, --Ad-hoc-- and –
Parametric-- Polymorphism.
43. --Ad-hoc-- polymorphism assume the ability to use the same methods name with
different implementations in the same class, but with different method signatures.
44. –Parametric-- polymorphism allow classes and methods to accept types as parameters.
45. Subtype polymorphism is considered as --Run time-- polymorphism.
46. –Inheritance-- can be considered as away to establish IS-A relationship between objects.
47. --late/dynamic binding-- means that the caller may not know the exact type of the
called object before calling the method, i.e. the behavior is determined at run time
instead of design time.
48. OOP languages provide the ad-hoc polymorphism using --Method overloading--.
49. Object of references are created in the –Heap-- memory, while their references are
created in the –Stack-- memory.
The exception classes in C# are mainly directly or indirectly derived from the?
A. System.Exception class
B. Exception class
C. System.ApplicationException class
D. ApplicationException class
5. The ________________ class is the base class for all predefined system exception
A. System.ApplicationException
B. System.SystemException
C. System.IO.IOException
D. System.IndexOutOfRangeException
A. finally clause is used to perform cleanup operations of closing network and database
connections
B. a program can contain multiple finally clauses
C. the statement in final clause will get executed no matter whether an exception occurs or
not
Exceptions can be thrown even from a constructor, whereas error codes cannot be
returned from a constructor. [T]
A try block must be associated with at least one catch or finally block.
finally clause is used to perform cleanup operations of closing network and database
connections