Sunday, May 17, 2015

C# Interview Questions

C# Interview Questions


1. The global assembly cache: 
a. Can store two dll files with the same name
b. Can store two dll files with the same name, but different version
c. Can store two dll files with the same name and same version
d. Can not store dll files with the same name
Answer: B

2. Which of the following is capable of returning multiple rows and multiple columns from the database?
a. ExecuteReader
b. ExecuteXmlReader
c. DataAdapter
d. All of the above
Answer: D 

3. Which of the following keywords prevents a class from being overridden further
a. Abstract
b. Sealed
c. Final
d. Root
e. Internal
Answer: B 

4. Which of the following is true about friend functions in C#
a. Friend functions violate the concept of OOPS
b. Friend functions should not be used
c. Friend functions enhance the concept of OOPS if used properly
d. Friends functions are not available in C#
Answer: D 

5. How can an abstract function be declared
a. By equating it to 1
b. By equating it to zero
c. By using the virtual keyword
d. By using the abstract keyword
Answer: D 

6. Which type of class members are associated with the class itself rather than the objects of the class?
a. Public
b. Protected
c. Private
d. Static
Answer: D 

7. C# has a keyword called ‘int’. Which .NET type does this map to?
a. System.Int16
b. System.Int32
c. System.Int64
d. System.int128
Answer: B 

8. Which of the following statements are true?
An abstract function
a. Is a function that takes no arguments
b. Can be defined in a class only if the class itself is also marked as abstract
c. Must be overridden in a derived class
d. Can be overridden in a derived class
Answer: A,C 

9. What is encapsulation?
a. Wrapping functions into a single unit
b. Wrapping functions and data into a single unit
c. Making the whole data accessible to the outer world
d. Making the whole data and functions accessible to the outer world
Answer: B 

10. How can you define a function in a derivced class having the same name as a non-virtual function in the base class?
a. You can do this simply by adding the function definition in the derived class. The function in the derived class will automatically hide the function in the parent class
b. By using the new keyword
c. By using the override keyword
d. You cannot do this, the base and derived classes cannot have non-virtual functions with the same name.
Answer: A 

11. ______________ namespace is not defined in the .NET class library.
a. System
b. System.CodeDom
c. System.IO
d. System.Thread
e. System.Text
Answer: E 

12. Asynchronous execution is supported in ADO.NET 2.0 for
a. ExecuteReader
b. ExecuteScalar
c. ExecuteNonQuery
d. All of the above
Answer: D 

13. Which of the following are not C# value types?
a. Long
b. Bool
c. Struct
d. Class
e. String
Answer: D,E 

14. Where does a C# assembly store the information regarding the other external dependencies, such as satellite assemblies, global assemblies etc, and their versions so that they can be loaded correctly when the assembly is executed?
a. In the embedded resources of the assembly
b. In the manifest of the assembly
c. In the MSIL of the assembly
d. In windows registry database
e. None of the above
Answer: B 

15. What is wrong with the code give below:
class CChkeck
{
public static void Main()
{
int nLen = 5;
int[] arrNum = new int[nLen];
}
}
a. The squre brackets[] should be with arrNum instead of int
b. You cannot use a variable to set the size of the array
c. int[] should be replaced with int()
d. nothing is wrong with the code. It will compile without errors.
Answer: D 

16. Which of the following is not a feature of .NET 2.0?
a. Partial classes
b. Generics
c. Multiple inheritance
d. Partial methods
Answer: C 

17. Which object oriented concept is related to the derivation of a class based on another class?
a. Encapsulation
b. Polymorphism
c. Data Hiding
d. Inheritance
e. Overloading
Answer: D 

18. Which of the following types of cursors are available with ADO.NET DataReader object?
a. Server-side, forward-only, and read-write cursor
b. Server-side, forward-only, and read-only cursor
c. Server-side, backward-only, and read-write cursor
d. Server-side, bidirectional, and read-only cursor
Answer: B 

19. Which of the following statements is correct with regard to .NET framework managed web pages?
a. They interact directly with the runtime
b. They do not execute in the native code language
c. They are interpreted and scripted
d. All of the above
Answer: D

No comments:

Post a Comment