Download C# Questions
Which of the following utilities can be used to compile managed assemblies into processor-specific native code?
gacutil
ngen
sn
dumpbin
2
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?
.NET class libraries
Common Language Runtime
Common Language Infrastructure
Component Object Model
1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following .NET components can be used to remove unused references from the managed heap?
Common Language Infrastructure
CLR
Garbage Collector
Class Loader
3
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following assemblies can be stored in Global Assembly Cache?
Private Assemblies
Friend Assemblies
Shared Assemblies
Public Assemblies
3
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Code that targets the Common Language Runtime is known as
Unmanaged
Native Code
Legacy
Managed Code
4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is NOT an Arithmetic operator in C#.NET?
**
+
/
%
1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is NOT a Bitwise operator in C#.NET?
&
|
<<
^
3
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is the correct output for the C#.NET code snippet given below? Console.WriteLine(13 / 2 + + 13 % 2);
6.5 1
6.5 0
6 0
6 1
4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?
A constructor can be used to set default values and limit instantiation.
C# provides a copy constructor.
Destructors are used with classes as well as structures.
A class can have more than one destructor.
1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct about constructors?
If we provide a one-argument constructor then the compiler still provides a zero-argument constructor
Static constructors can use optional arguments.
Overloaded constructors cannot use optional arguments.
If we do not provide a constructor, then the compiler provides a zero-argument constructor
4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
How many times can a constructor be called during lifetime of the object?
As many times as we call it.
Only once.
Depends upon a Project Setting made in Visual Studio.NET.
Any number of times before the object gets garbage collected.
2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
If s1 and s2 are references to two strings, then which of the following is the correct way to compare the two references?
s1 is s2
s1 = s2
s1 == s2
s1.Equals(s2)
4
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct about properties used in C#.NET?
A property can simultaneously be read only or write only.
A property can be either read only or write only.
A write only property will have only get accessor.
A write only property will always return a value.
2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct about properties used in C#.NET?
Every property must have a set accessor and a get accessor.
Properties cannot be overloaded.
Properties of a class are actually methods that work like data members.
A property has to be either read only or a write only.
3
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
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?
new
base
override
overloads
1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?
When used as a modifier, the new keyword explicitly hides a member inherited from a base class.
Operator overloading works in different ways for structures and classes.
It is not necessary that all operator overloads are static methods of the class.
The cast operator can be overloaded.
1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following keyword is used to overload user-defined types by defining static member functions?
op
opoverload
operator
operatoroverload
3
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is incorrect about delegate?
Delegates are reference types.
Delegates are object oriented.
Delegates serve the same purpose as function pointers in C and pointers to member function operators in C++.
Only one method can be called using a delegate.
4
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is the necessary condition for implementing delegates?
Class declaration
Inheritance
Run-time Polymorphism
Exceptions
1
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements are correct about delegates?
Delegates cannot be used to call a static method of a class.
Delegates cannot be used to call procedures that receive variable number of arguments.
If signatures of two methods are same they can be called through the same delegate object.
Delegates cannot be used to call an instance function. Delegates cannot be used to call an instance subroutine.
2
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Suppose on pushing a button an object is to be notified, but it is not known until runtime which object should be notified. Which of the following programming constructs should be used to implement this idea?
Attribute
Delegate
Namespace
Interface
2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is an 8-byte Integer?
Char
Long
Short
Byte
2
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is NOT an Integer?
Char
Byte
Integer
Short
1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?
Information is never lost during narrowing conversions.
The CInteger() function can be used to convert a Single to an Integer.
Widening conversions take place automatically.
Assigning an Integer to an Object type is known as Unboxing.
3
Which of the following utilities can be used to compile managed assemblies into processor-specific native code?
gacutil
ngen
sn
dumpbin
2
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?
.NET class libraries
Common Language Runtime
Common Language Infrastructure
Component Object Model
1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following .NET components can be used to remove unused references from the managed heap?
Common Language Infrastructure
CLR
Garbage Collector
Class Loader
3
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following assemblies can be stored in Global Assembly Cache?
Private Assemblies
Friend Assemblies
Shared Assemblies
Public Assemblies
3
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Code that targets the Common Language Runtime is known as
Unmanaged
Native Code
Legacy
Managed Code
4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is NOT an Arithmetic operator in C#.NET?
**
+
/
%
1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is NOT a Bitwise operator in C#.NET?
&
|
<<
^
3
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is the correct output for the C#.NET code snippet given below? Console.WriteLine(13 / 2 + + 13 % 2);
6.5 1
6.5 0
6 0
6 1
4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?
A constructor can be used to set default values and limit instantiation.
C# provides a copy constructor.
Destructors are used with classes as well as structures.
A class can have more than one destructor.
1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct about constructors?
If we provide a one-argument constructor then the compiler still provides a zero-argument constructor
Static constructors can use optional arguments.
Overloaded constructors cannot use optional arguments.
If we do not provide a constructor, then the compiler provides a zero-argument constructor
4
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
How many times can a constructor be called during lifetime of the object?
As many times as we call it.
Only once.
Depends upon a Project Setting made in Visual Studio.NET.
Any number of times before the object gets garbage collected.
2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
If s1 and s2 are references to two strings, then which of the following is the correct way to compare the two references?
s1 is s2
s1 = s2
s1 == s2
s1.Equals(s2)
4
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct about properties used in C#.NET?
A property can simultaneously be read only or write only.
A property can be either read only or write only.
A write only property will have only get accessor.
A write only property will always return a value.
2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct about properties used in C#.NET?
Every property must have a set accessor and a get accessor.
Properties cannot be overloaded.
Properties of a class are actually methods that work like data members.
A property has to be either read only or a write only.
3
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
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?
new
base
override
overloads
1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?
When used as a modifier, the new keyword explicitly hides a member inherited from a base class.
Operator overloading works in different ways for structures and classes.
It is not necessary that all operator overloads are static methods of the class.
The cast operator can be overloaded.
1
````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following keyword is used to overload user-defined types by defining static member functions?
op
opoverload
operator
operatoroverload
3
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is incorrect about delegate?
Delegates are reference types.
Delegates are object oriented.
Delegates serve the same purpose as function pointers in C and pointers to member function operators in C++.
Only one method can be called using a delegate.
4
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is the necessary condition for implementing delegates?
Class declaration
Inheritance
Run-time Polymorphism
Exceptions
1
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements are correct about delegates?
Delegates cannot be used to call a static method of a class.
Delegates cannot be used to call procedures that receive variable number of arguments.
If signatures of two methods are same they can be called through the same delegate object.
Delegates cannot be used to call an instance function. Delegates cannot be used to call an instance subroutine.
2
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Suppose on pushing a button an object is to be notified, but it is not known until runtime which object should be notified. Which of the following programming constructs should be used to implement this idea?
Attribute
Delegate
Namespace
Interface
2
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is an 8-byte Integer?
Char
Long
Short
Byte
2
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following is NOT an Integer?
Char
Byte
Integer
Short
1
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Which of the following statements is correct?
Information is never lost during narrowing conversions.
The CInteger() function can be used to convert a Single to an Integer.
Widening conversions take place automatically.
Assigning an Integer to an Object type is known as Unboxing.
3
No comments:
Post a Comment