Tuesday, May 4, 2010

Test 2 (C# Must Read )


1. Abstraction Is an activity which is carried out while analyzing the problem domain to represent an entity. It is an act of extracting the useful , meaningful and relevant information out of the problem domain ignoring the rest

2.  Modularity  is all about managing the complexity of software by breaking that into modules. In structured approach these modules are functions and structures where as  in OOPS these modules are classes which intern encapsulate related data and functions.

3. Encapsulation  is all about hiding the data in the class along with the public interfaces so that the data can be accessed only through well defined functions ,protecting from unintended actions and inadvertent access. 

4. Data encapsulation is also called data  hiding .

5. Hierarchy is all about relating the classes through - a kind of - relationship called  inheritance .

6. Polymorphism  is an act of making different objects act in many different  forms on receiving identical messages

7. Different functions taking care of similar kind of activities can be given similar names and  be differentiated by passing different  arguments is called  function overloading .

8. C# code is compiled as
a. managed code  b. compiled code c. unsafe code  d. Intermediate code

9. The ________ provides useful set of  classes
a. using  b. .NET Framework library  c. Inheritance

10. The main method should be declared as
a. private  b. protected  c. internal  d. public

11. Console is a utility kind of class which is member of System namespace.

12. Console class represents all the console related activities like reading from the keyboard and writing on to the monitor.

13. C# Compiler generate files which are called assemblies. name them(select three)
a. .exe  b. .winexe  c. .dll  d. .netModule

14. VS.NET enables an Application or Component to be built in which two modes.
a. Debug   b. Trace   c. Release   d. Cache

15. When the build is done in debug mode under the /bin directory, a directory /debug is created and a file with the .pdb is created which stands for Portable debug database.
16. ________mode is useful when Application / Component is ready to be released to the target system
a. Debug   b. Trace   c. Release   d. Cache

17. MSIL is compiled using
a. CSharp compiler  b. respective language compiler  c. JIT  d. PreCompiled

18. Based on the storage, C# data types can be categorized into two category ________ & ________
a. Value  b. heap  c. reference  d. stack

19. Value type data is allocated on the ________
a. Value  b. heap  c. reference  d. stack

20. Reference type data is saved on the heap and a pointer to the heap object is on the ________
a. Value  b. heap  c. reference  d. stack

21. If the object has no references, it is subject to garbage collection.
true/false

22. Checked operator enforces the arithmetic overflow and underflow checking  for arithmetic operations and conversions

23. what is the output
byte b1=255; b1+=2; Console.WriteLine("b1:"+b1);
a. Throws exception  b. prints 0  c. prints 257  d. prints 1

24. The ________ operator is used to check whether the run-time type of an object is compatible with a given type.
a. is     b. as     c. ==    d. typeof()

25. ________ used to perform conversions between compatible types.
a. is      b. as    c. ==    d. typeof()

26. Is used to iterate through a set of objects
a. foreach  b. select   c. switch   d. if else

27. .Each instance will have its own copy of ________variable basically this type of variables differentiate one object from the other.
a. instance   b. global   c. static   d. class

28. Only one copy of ________variable is maintained per class
a. instance   b. global   c. static   d. class

29. ________functions Can  be called only with the help of objects
a. instance   b. global   c. static   d. class

30. ________functions are declared with the help of static keyword.(pick most appropriate)
a. instance   b. global   c. static   d. class

31. Private access specifier hides the members with in the class.
a. public   b. private   c. protected   d. internal

32.  Internal access specifier hides the members with in Assembly
a. public   b. private   c. protected   d. internal

33. Protected access specifier hides the members with in the class but exposed out  through inheritance.

a. public   b. private   c. protected   d. internal
34. ________function Enable properties of a class/objects to be visible externally as fields.
a. absolute   b. property   c. built in   d. string

35. Property function with just get{} makes the property ________.
a. Write only   b. read only

36. ________are invoked immediately after  the memory allocation for an object.
a. Instance constructors’   b. class constructors’   c. methods  d. destructors

37. A class can have only one class constructor declared with the help of ________ keyword.
a.  public   b. private   c. dynamic   d. static

38. ________ is invoked when a class is loaded
a. Instance constructors’   b. class constructors   c. methods  d. destructors

39. Destructors Are invoked immediately before the memory de-allocation for an object

40. Destructors are called automatically by the Garbage Collector whenever Managed resources  are released

41. Garbage Collector  takes care of automatic memory de-allocation 

42. Before collecting the memory associated with an object GC makes a call to the destructor associated with it.

43. Explicit call to GC can be make through the collect method.

44. .NET BCL or FCL (Framework Class Library ) is rich set of classes , arranged in a inverted tree like structure with super most class as System.Object class.

45. C# support only Single , multilevel and hierarchical inheritance. (true)

46. base  keyword is used by a sub class for referring to its immediate super class

47. There are two ways of redefining/Customizing  the function of super class in the sub class ( keeping the method signature exactly the same)method overriding and method hiding.

48. If method is not declared as virtual in the super class it can be redefined in the sub class using new  keyword

49. If method is redefined in the sub class using new keyword then the methods will be called based on the type of the objects ________them
a. calling   b. referencing

50. Abstract Classes  are partly complete and partly incomplete therefore can be extended but cannot instantiated.

51. Concrete classes classes are regular classes can be instantiated and  extended both.
52. Sealed classes are final cannot be further extended.

53. Utility classes are the classes with the members declared as static and optionally default constructor declared as private.

54. Interfaces  are purely the combination of abstract behavior.

55. An Interface can not extend more than one interface (true/false)

56. ________ enables the logical grouping of related types
a. Namespace   b. Assembly    c. Interface

57. NET BCL can considered a collection of namespaces (true/false)

58.  Namespaces can contain sub namespaces and other types like  classes , Interfaces , structures , Enumerations and delegates
a. namespace b. Assembly  c. interface

59. In the case of overriding always ________ is given the importance.
a. reference types    b. overridden method   c. virtual method   d. Interfaces

60. In  the case  of method hiding the ________ is given importance
a. reference type    b. overridden method   c. virtual method   d. Interfaces
61. ________are said to be the key to access the implementation of the object that provides the implementation of the same interface
a. reference type    b. overridden method   c. virtual method   d. Interfaces

62. ________ class is designed to provide all array related features
a. System.Array.Sort   b. System.Array   c. System.Collections d. System.String

63. ________ class provides string related functions
a. System.Array.Sort   b. System.Array   c. System.Collections d. System.String

64. A string is a ________type
a. Value    b. reference

65. ________makes the object treated as an array.
a. Property    b. Indexer    c. Method   d. Array declaration

66. If a class / structure has Indexer defined, its object can act as array thus allowing instances of a class , structure to be indexed in the same way as arrays.

67. The name of the indexer will be ________
a. base    b. class name    c. this    d. that

68. Indexers are similar to properties except that their accessors take parameters (true/false)

69. ________in .NET is all about  managing  set of objects and carrying  out manipulation over them
a. correlation   b. Collections    c. Arrays    d. arraylist

70. ________ Makes implementing class capable of allowing traversal over collection of object through IEnumerator object the it supplies.
a. IEnumerable    b. IDictionary  c. ICollection   d. IList

71. ________ Makes implementing class capable of offering the storage capability
a. IEnumerable    b. IDictionary  c. ICollection   d. IList

72. ICollection – Provides property like  ________, giving the number of  objects in the collection
a. count    b. sum   c.Hasrows   d.total

73. Stack is Designed to work based on ________approach
a. FIFO    b. LIFO    c.LILO

74. Queue is Designed to work  based on ________approach
a. FIFO    b. LIFO    c.FILO

75. ________Supplies features for indexed based operation over collection of objects
a. IEnumerable    b. ICollection   c. IList

76. ________Supplies features for key based operation over collection of objects
a. IEnumerable    b. IDictionary  c. ICollection   d. IList

77. ________Represents a collection of key-and-value pairs that are sorted by the keys and are accessible by key and by index.
a. ArrayList    b. SortedList    c. List    d. Array

78. A variable passed as an ________argument need not be initialized.However, it  must be assigned a value before the method returns.
a. Val   b. Ref   c. Out

79. The ________enables passed by reference thereby making calling method and called method both referring  to the same variable
a. Val   b. ref   c. Out

80. ________is an unusual situation that an application may come across while its execution.
a. Error   b. Exception   c. stack tracing   d. diagnostic

81. ________class provides  a set of properties and methods that help finding out the reason behind the Exception Raise ,identify the source object that has raised the exception
a. Error   b. Exception   c. stack tracing   d. diagnostic

82. ________contains the information regarding the order of the method call prior to the raise of exception
a. Error   b. Exception   c. stack tracing   d. diagnostic

83. System.SystemException is a super class of all the exceptions in the System namespace

84. the property maintains the causal relationship exists between two or more exceptions.
a. InnerException  b. Exception handling c. relationship   d. Link

85. ________ is all about making an application capable of handling so  called Exception that it may come across while its execution.
a. InnerException  b. Exception handling c. relationship   d. Link

86. A try can have multiple catch block to address multiple Exceptions(true/false)

87. ________block is useful for cleaning up any resources allocated in the try block.
a. catch   b. finally    c. try
88. in a try catch finally block Control is always passed to the ________block regardless of whether the Exception is raised or not.
a. catch   b. finally    c. try

89. A Custom Exception should extend ________class to represent  specific custom requirement
a. System   b. ApplicationException   c. Exception   d. throw

90. A Delegate is a new kind of type with the keyword and class representation both.
This type can produce object which can hold  information about function(s)

91. A delegate declaration defines a reference type that can be used to encapsulate a function with a specific signature
a. method   b. Property   c. class  d. variable

92. A delegate doesn't let you pass a function as a parameter (true/false)

93. In Single casting category, delegate object hold information about only one function

94. In Multiple casting category, delegate object hold information about multiple function

95. A delegate can hold information about more than one methods (true/false)

96. An ________is a way to signal that something of interest has happened
a. delegate   b. event    c. Exception

97. eventDelegate is a delegate declares the signature of the event handler method

98. In C# delegate object plays very important role in event declaration and registration of event with  the event handler

99. Directives are said to be instructions to the compiler

100. They can be categorized into following categories preprocessor directives & attributes .
















  1. what normalization specifies atomic columns….1st,2nd,3rd….
  2. forms are under what namespace and assembly………sysem.web.ul.webcontrols
  3. if a method is virtual means……..it must be overridden,it can be overridden,it can be overloaded
  4. runtime polymorphism can be utilized by …inheritance,overloading or overriding, none of above  constructor is inheritable in c#....true , false
  5. xml element shud be……lower case,,,,,
  6. define role……group of privileges,number of people have same privileges,both,none
  7. the type of all the elements in an array is……….same,void,,,,
  8. imethod is virtual means…..class is not real,method can be overridden,method can be overloaded,,
  9. queue can be filled by which method…….enqueue
  10. best way to retrieve date with key values……hashtabel,Ilistdictory……………
  11. Function that require 5 should use………..class or struct,class,arraylist
  12. Which property to set to make single line textbox to multiple
   20)  What is equivalence to regsvr32.exe?
                       1. regasm
                       2. regser ...
   21)  what is functionality of base
   22)  control has …………………….property to bind ADO
   23) custom exception should derive…………………ApplicatioException
   24)  calendar control uses which namespace ……………….system..web.ul.webcontrols
   25)  
   26)  types of constructor…………….instance and static,static,instance,none
   27)  two common properties of validation control…………controlToValidate and text,controltovalidate and controltext,controltovalidate and controlid
   28)  method to get types using system.reflection…….getTypes()
   29)   pick the incorrect one………..abstract class cannot be instantiated,abstract class can have one or more abstract function, all
   30)   standard controls are…………..1)adrotator, 2) label, 3) ……4) all
   31)   remoting in generics………true or false
   32)   strong name assembly is tamper resistant……..true or false
   33)   scope of internal protected
   34)   syntax for LOCK TABLE
   35)   module m
               Public …….
                   Init=100;
               Public method()
                   Init=200;
                Printf(“init”,&init)
              Close method
             Close…………….
          What will be the outcome?
         Init=100;init=200;init=300;init=400;
     36) difference between class and struct……….class is value type and struct is referrnc type……..
     37) access modifier of destructor……..public,private,static,none
     38) databind will establish connection of data bound control with……………..database,connectionstring……..
     39) the highest class from which other class are deived is system.object,system.objecti, system.objectu
     40) one jagged array………int sample[][]=new int[3][];sample[0]=new int[5];sample[1]=new int[3];sample[2]=new int[4];
            Number these from 1 to 12…….what is the index of 9 number element…………..sample[2][1]……..
      41) indexer can have out and ref parameter………true /false
       42) indexer can make array of………instance of class
       43)xml document
      44)event can be declared in interface………..true /false
     45) how to obtain a new messagebox and text within it……………messagebox.show(‘ffff’’);,messagebox();
      46)how to center the form………….startpostion,centerposition



1. What is DEFAULT? What is the use of defaults?
2. What is virtual?
3. If both the base and child class contains virtual keyword then what happens?
4.
try { }
finally { }

What happens when we run the program?

5. If a structure contains an int and a Single. What is the size of structure?
a 2 bytes
b 10 bytes
c 12 bytes
d none of the above    
 
6. If we want to make the methods non inheritable which keyword is used?

7. What is the scope of internal protected?

8. What are DCL commands?

9. Is xml case sensitive?

10. Deference between the Indexers in c# and c++?

11. What is achieved by the keyword overridable?

            1 Run time polymorphism
            2 Compile time polymorphism
            3 Encapsulation
            4 Hiding
12. What are the templates in Repeater control?
13. What are the templates in DataGrid?

14. What are the templates in DataList?
15. Indexes can be created on tables and views?


1.      Which of the following can be included in an interface?
a.      Methods
b.      Properties
c.       Indexers
d.      Events
e.      All of the above
2.      Which term is used within the implementation of a property's setter to access the implicit parameter being passed to the property?
a.      this
b.      value
c.       arg
d.      property
3.      True or false: accessing a type defined in the same namespace requires use of the fully qualified name.
a.      True
b.      False
4.      Given the following code:
Interface IDog
{
Void Walk ();
Void Run ();
Void Lay ();
Void Sit ();
}

Which of the following statements is true?
a.      Any class that implements IDog must define at least one of the four listed methods
b.      Any class that implements IDog can override any of the four listed methods.
c.       Any class that implements IDog can override any of the four listed methods.
d.      Any class that implements IDog must define only the four listed methods.
e.      Any class that implements IDog must define all four listed methods

5.      Which of the following correctly specifies an interface named ITeller with a public method named Withdraw?
a.        interface ITeller { void Withdraw(double amount); }
b.        interface ITeller(Withdraw)

6.      Int[] myArray = new int[10]; What will be the value of myArray[1]?
a.      0
b.      10
c.       Null
d.      A null reference exception will be thrown

7.      If test is a Random object, then what expression will return a value between 0 and 100?
a.      Next.test(100)
b.      test.Next(100)
c.       test(0,100)
d.      test(Next(100))
8.      True or false: a namespace must be completely defined in a single source file.
a.      True
b.      False
9.      True or false: constructors may be overloaded
a.      True
b.      False
10.  A delegate field has what initial value?
a.      Zero
b.      Null
c.       Empty string
11.  int myCounter = 10;
int inloop = 0;

for (myCounter=0; myCounter != 100; myCounter = myCounter + 2)
{
inloop++;
}

After the loop is finished, what will the value of inloop be?
a.      100
b.      101
c.       51
d.      45
e.      50
12.  Which of the following is a value type, and not a reference type?
a.      Array
b.      Delegate
c.       Enum
d.      Class
13.  True or false: when an object is allocated, all fields are set to a default value determined by their type.
a.      True
b.      False
14.  What is the difference between a Struct and a Class?
a.      Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval.
b.      Structs are reference-type variables and are thus saved on the stack, additional overhead but faster retrieval.
c.       Structs are value-type variables and are thus saved on the heap, additional overhead but faster retrieval.
d.      Structs are reference-type variables and are thus saved on the heap, additional overhead but faster retrieval
15.  Which operator is used to allocate memory for an instance of a class, as well as to pass arguments to a constructor of that class?
a.      New
b.      Delete
c.       Alloc
d.      Malloc
16.  Reading an integer is done with
a.      Console.ReadLine();
b.      Int32.Parse(Console.ReadLine());
c.       Int32.Parse.Console.Readline();
d.      Parse(Console.ReadLine());
17.  // create some strings to work with
string s1 = "One,Two,Three Liberty Associates, Inc.";

// constants for the space and comma characters
const char Space = ' ';
const char Comma = ',';

// array of delimiters to split the sentence with
char[] delimiters = new char[]
{
Space,
Comma
};

string output = "";
int ctr = 1;

// split the string and then iterate over the
// resulting array of strings

// foreach (string subString in s1.Split(' ', ','))

foreach ( string subString in s1.Split( delimiters ) )
{
output += ctr++;
output += ": ";
output += subString;
output += " ";
}
Console.WriteLine( output );
a.      1: One 2: Two 3: Three 4: Liberty 5: Associates 6: Inc.
b.      1: One 2: Two 3: Three 4: Liberty 5: Associates 6: Inc.
c.       1: One 2: Two 3: Three 4: Liberty 5: Associates 6:
d.      1: One 2: Two 3: Three 4: Liberty 5: Associates 6: 7:
18.  using System;
public class Parent
{
string parentString;
public Parent()
{
Console.WriteLine("Parent Constructor.");
}
public Parent(string myString)
{
parentString = myString;
Console.WriteLine(parentString);
}

public void print()
{
Console.WriteLine("I'm a Parent Class.");
}
}

public class Child : Parent
{
public Child() : base("From Derived")
{
Console.WriteLine("Child Constructor.");
}
public new void print()
{
base.print();
Console.WriteLine("I'm a Child Class.");
}
public static void Main()
{
Child child = new Child();
child.print();
((Parent)child).print();
}

}

Output:
a.      From Derived Child Constructor. I'm a Child Class. I'm a Parent Class. I'm a Parent Class
b.      Child Constructor. From Derived I'm a Parent Class. I'm a Child Class. I'm a Parent Class
c.       From Derived Child Constructor. I'm a Parent Class. I'm a Child Class. I'm a Parent Class
19.  Which C# keyword can be applied to a class to prevent it from being used as a base class?
a.      Sealed
b.      Non inheritable
c.       Final
d.      Abstract
20.  How many subscribers may be registered with a delegate?

a.      None - only an event can have registered subscribers
b.      One
c.       As many as needed
21.  // abstract_keyword.cs
// Abstract Classes
using System;
abstract class BaseClass // Abstract class
{
protected int _x = 100;
protected int _y = 150;
public abstract void AbstractMethod(); // Abstract method
public abstract int X { get; }
public abstract int Y { get; }
}

class DerivedClass : BaseClass
{
public override void AbstractMethod()
{
_x++;
_y++;
}

public override int X // overriding property
{
get
{
return _x + 10;
}
}

public override int Y // overriding property
{
get
{
return _y + 10;
}
}

static void Main()
{
BaseClass bc = new BaseClass();
o.AbstractMethod();
Console.WriteLine("x = {0}, y = {1}", o.X, o.Y);
}
}
a.      x = 111, y = 161
b.      x = 100, y = 150
c.       x = 101, y = 151
d.      error
22.  A derived class...
a.      Inherits fields and methods defined in its base clas
b.      Can add new fields
c.       Can hide methods defined in the base class
d.      Expresses a specialization of the base class
e.      All the above
23.  True or false: namespaces can be nested
a.      True
b.      False
24.  In C#, which of the following is not a valid C# jump statement?
a.      Jump
b.      Goto
c.       Return
d.      throw
25.  True or false: interfaces represent concrete types that convey implementation details such as fields and method implementations.

a.      True
b.      False
26.  Why can’t you specify the accessibility modifier for methods inside the interface
a.      They are all private
b.      They are all public
c.       They are all protected
27.  Which of the following is not a keyword in C#?
a.      Public
b.      Private
c.       Abstract
d.      Protect


28.  What does the keyword “virtual” declare for a method or property?
a.      The method or property can have a duplicate name within the same assembly
b.      The method or property doesn't exist exist in the context of the object at design time
c.       The method or property can be overridden


29.  Which members can be accessed through an object reference?
a.      Only the object class members
b.      All members
c.       No members


  1. Is this syntax valid?

    struct student
    {
    public student()
    {
    }
    }
    1. Yes
    2. No
    3. Under Certain Conditions
  2. Pick the command line that would result in the C# compiler generating an XML documentation file:
    1. csc /doc:HelloWorld.xml HelloWorld.cs
    2. csc /doc /docfile:HelloWorld.xml HelloWorld.c
    3. csc /doc /out:HelloWorld.xml HelloWorld.cs
    4. csc /xml HelloWorld.cs
  3. Which construct is used to handle exceptions that might be raised within a certain section of code?
    1. try/catch
    2. try/finally
  4. Is the static modifier on the program entry point required?
    1. Yes
    2. No
  5. True or false: exceptions may be generated by the runtime or by user-defined code
    1. True
    2. False
  6. Which of the following statements will result in a null reference being stored in p if the object referenced with variable o is not actually an instance of the Pet class?
    1. Pet p = (Pet)o;
    2. Pet p = o as Pet
    3. bool isPet = o is Pet;
  7. The term "dynamic binding" means:
    1. The method called is based the type of the reference used to make the call.
    2. The method called is determined based on the runtime type of the object
    3. The arguments passed to the method will not be used to determine which method to call.
  8. True or false: C# allows indexers to be overloaded.
    1. True
    2. False
  9. Does this code compile?

    public interface MyInterface
    {
    string MyProp { get; }
    }
    1. Yes
    2. No, because the interface name does not start with 'I'
    3. No, because MyProp is not declared as public
    4. No, because interfaces can't contain property declarations
  10. Which of the following represent valid local variable declarations?
    1. int x;
    2. int x, y;
    3. int x = 2, y = 4, z = x + y;
    4. int x = 2 * 4;
    5. all of  the above
  11. Which object class methods can a derived class override?
    1. All of them
    2. Only the Tostring methods
    3. Only the Virtual Methods
  12. class Operations
    {
    public void Process( )
    {
    Stack stack = new Stack( );
    stack.Push(24);
    stack.Push(stack);
    object o = (Stack)stack.Pop( );
    stack.Push("C# 2.0");
    Console.WriteLine(((Stack)o).Pop( ));
    }
    }

    What is the output from above program?
    1. 24,count=2,c#2.0
    2. 24,C# 2.0
    3. 24
    4. C# 2.0
  13. True or false: The SqlCommand class supports execution of both queries and stored procedures
    1. True
    2. False
  14. Can multiple catch blocks be executed for a single try statement?
    1. Yes
    2. no
    3. under certain conditions
  15. The DataSet class can best be described as a...
    1. A disconnected, in memory database
    2. local cache of database data that stays connected to the database and automatically forwards any changes made to the local copy so the cache and the database always stay in synch
    3. A database view that only supports operations such as insert and update but does not allow retrievals using select
  16. True or false: the catch and finally constructs may be associated with the same try block.
    1. True
    2. False
  17. using System;
    struct MyStruct
    {
    int x;
    int y;
    public MyStruct(int i, int j)
    : this(i + j)
    { }
    public MyStruct(int i)
    { x = y = i; }
    public void ShowXY()
    { Console.WriteLine("The field values are {0} & {1}", x, y); }
    }
    class MyClient
    {
    public static void Main()
    {
    MyStruct ms1 = new MyStruct(10, 20);
    ms1.ShowXY();
    }
    }

    Whats the outcome
    1. the field values are 30 & 30
    2. The field values are 10 & 20
    3. The field values are 20 & 10
    4. Error

  1. Which collection in System.Collections.Generic can be described as 'last-in-first-out'?
    1. Stack
    2. Queue
    3. SortedList
    4. Arraylist
  2. True or false: one constructor can call another constructor in the same class.
    1. True
    2. False
  3. True or false: a class can implement more than one interface
    1. True
    2. False
  4. True or false: it is possible to write the simple types directly to a binary file using the methods in the FileStream class.
    1. True
    2. False
  5. Is the name of the program entry point case sensitive?
    1. Yes
    2. No
  6. does c# support templates
    1. true
    2. false
    3. sometimes
  7. C# types are defined in ____________, organized by ____________, compiled into __________, and then grouped into ____________.
    1. files, modules, namespaces, assemblies
    2. files, namespaces, assemblies, modules
    3. files, assemblies, namespaces, modules
    4. files, namespaces, modules, assemblies
  8. can we have protected element as a namespace member?
    eg
    namespace mine
    {
    protected class test
    {
    }
    }
    1. yes,all access specifiers are valid for namespace members
    2. No,only private access specifiers are possible
    3. No,only private access specifiers are possible
    4. No,the namespace allows only public and internal elements as its members
  9. struct MyStruct
    {
    public int x = 25;
    public int y = 50;
    }
    class MyClient
    {
    public static void Main()
    {
    int sum = MyStruct.x + MyStruct.y;
    Console.WriteLine("The sum is {0}",sum);
    }
    }
    Will product a compile error. What would fix this
    1. declare x and y as protected fields
    2. declare x and y as static fields
    3. declaring MyStruct as a public structure
    4. declaring MyStruct as a protected structure
  10. True or false: A data reader such as SqlDataReader allows forward and backward traversal of the contained data.
    1. True
    2. False
  11. True or false: Preprocessor symbols can be given user defined values.
    1. true
    2. false
  12. True or false: the C# compiler is responsible for dealing with preprocessor directives.
    1. True
    2. Fasle
  13. True or false: the #region directive provides a way to comment out blocks of code.
    1. True
    2. Fasle
  14. Which one of these is not the common dialog box that are available with windows application?
    1. ColorDialog
    2. FontDialog
    3. PrintDialog
    4. Pagesetup dialog
    5. CPuSetup dialog
  15. What information is specified by a delegate?
    1. The types of the objects involved in the registration and callback
    2. The name of the callback method
    3. The parameter list and return type of the callback method
  16. True or false: the ArrayList class will automatically adjust its capacity as needed.
    1. True
    2. False
  17. True or false: it is possible to write the simple types directly to a binary file using the methods in the FileStream class.
    1. True
    2. False
  18. True or false: the CLR allows custom exceptions to be defined.
    1. True
    2. False
  19. Which of the following is the C# escape character for Null?
    1. \n
    2. \o
    3. \0
    4. \t
  20. True or false: The SqlCommand class supports execution of both queries and stored procedures
    1. True
    2. False
  21. Shared assemblies are installed where?
    1. System Assembly Cache
    2. Global Assembly Cache
    3. Machine Assembly Cache
    4. Windows Assembly Cache
  22. rue or false: Connection resources such as SqlConnection should be manually closed by the programmer.
    1. True
    2. False
  23. The main purpose of guarding code with the #if directive is to...
    1. Generate more meaningful error messages
    2. Selectively include/exclude code from the next stage of compilation
    3. Avoid the overhead of dynamic method binding
  24. The statement that is used to replace multiple if statements is called
    1. The switch & case statement
    2. ?: Operator
    3. The nestedif statement
    4. The #endif statement
  25. Can multiple catch blocks be executed for a single try statement?
    1. Yes
    2. No
    3. Under certain conditions
  26. True or false: C# supports multiple inheritance
    1. True
    2. False

  1. When do you absolutely have to declare a class as abstract?
    1. When at least one of the methods in the class is abstract.
    2. When all the methods in the class is abstract.
  2. Which tool would you use, if you want to see all the methods of a particular class in your application
    1. Class viewer
    2. Object Browser
    3. Class Explorer
    4. Solution Explorer
  3. What tool is used to manage the assemblies in the Global Assembly Cache?
    1. gacmgr.exe
    2. gacutil.exe
    3. GASSY.EXE
    4. Util.exe
  4. You have been asked to become a member of the build team for your company.
    The development team has created 6 new components that need to be assigned Strong names. Which of the following tools would you use to create the .snk files?
    1. Use the ilasm.exe utility
    2. Use the sn.exe utility
    3. Use the gacutil.exe utility
    4. Use the resgen.exe utility
  5. What is CLR
    1. Class Load Runner
    2. Common Language Runtime
    3. Common Load Runner
    4. Common Language Runner
    5. None
  6. Which tool allows you to install an assembly into the GAC?
    1. Ngen.exe
    2. Mscorcfg.msc
    3. Setup.exe
    4. sn.exe
  7. How do you allow the user to select a file to open in your Desktop Application?
    1. Use the method System.IO.File.Open
    2. Use the method System.Windows.Forms.Prompt
    3. Use an object of type System.IO.File.FileOpener
    4. Use an object of type System.Windows.Forms.OpenFileDialog
  8.   Which one of these are not a part of .Net Enterprise Servers
    1. SQL server
    2. BIZTALK Server
    3. Share Point Portral Server
    4. Exchange Server
    5. Sun Server
  9. this contains description of all types contained in an assembly
    1. GAC
    2. Metadata
    3. Resources
    4. Folder Properties
  10. Shared assembly are signed with strong name
    1. True
False

General Questions

1.         Does C# support multiple-inheritance?
              No.

      2.  Who is a protected class-level variable available to?
              It is available to any sub-class (a class inheriting this class).

      3.  Are private class-level variables inherited?
              Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are Inherited.  

       4. Describe the accessibility modifier “protected internal”.
              It is available to classes that are within the same assembly and derived from the specified base class.
  
       5. What’s the top .NET class that everything is derived from?
               System.Object.

       6. What does the term immutable mean?
               The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

       7. What’s the difference between System.String and System.Text.StringBuilder classes?
                System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
 
       8. What’s the advantage of using System.Text.StringBuilder over System.String?
               StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time a string is changed, a new instance in memory is created.

       9.  Can you store multiple data types in System.Array?
              No.

       10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
                The Clone() method returns a new array (a shallow copy) object containing all the elements in the original  array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A  shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

       11. How can you sort the elements of the array in descending order?
                By calling Sort() and then Reverse() methods.

       12. What’s the .NET collection class that allows an element to be accessed using a unique key?
                 HashTable.

        13. What class is underneath the SortedList class?
                 A sorted HashTable.
                 
        14. Will the finally block get executed if an exception has not occurred?¬
                  Yes.                                                      
          
        15. What’s the C# syntax to catch any possible exception?
                  A catch block that catches the exception of type System.Exception.  You can also omit the parameter data type in this case and just write catch {}.

        16. Can multiple catch blocks be executed for a single try statement?
                 No.  Once the proper catch block processed, control is transferred to the finally block (if there are any).

         17. Explain the three services model commonly know as a three-tier application.
                  Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).


       Class Questions

        1. What is the syntax to inherit from a class in C#?
                Place a colon and then the name of the base class.
             Example: class MyNewClass : MyBaseClass
  
       2. Can you prevent your class from being inherited by another class?
              Yes.  The keyword “sealed” will prevent the class from being inherited. 

       3. Can you allow a class to be inherited, but prevent the method from being over-ridden?
              Yes.  Just leave the class public and make the method sealed.

       4. What’s an abstract class?
              A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden.  An abstract class is essentially a blueprint for a class without any implementation.

       5. When do you absolutely have to declare a class as abstract?
              1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
              2.  When at least one of the methods in the class is abstract.

       6. What is an interface class?
               Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

        7. Why can’t you specify the accessibility modifier for methods inside the interface?
               They all must be public, and are therefore public by default.

        8. Can you inherit multiple interfaces?
              Yes.  .NET does support multiple interfaces.

        9. What’s the difference between an interface and abstract class?
               In an interface class, all methods are abstract - there is no implementation.  In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed.  An abstract class may have accessibility modifiers.

        10. What is the difference between a Struct and a Class?
                Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval.  Another difference is that structs cannot inherit.

Method & Property Questions

  1. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
         Value.  The data type of the value parameter is defined by whatever data type the property is declared as.

  2. What does the keyword “virtual” declare for a method or property?
         The method or property can be overridden.

  3. How is method overriding different from method overloading?
         When overriding a method, you change the behavior of the method for the derived class.  Overloading a method simply involves having another method with the same name within the class.

  4. Can you declare an override method to be static if the original method is not static?
        No.  The signature of the virtual method must remain the same.  (Note: Only the keyword virtual is changed to keyword override.

  5. What are the different ways a method can be overloaded?
         Different parameter data types, different number of parameters, different order of parameters.

  6. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
        Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Events & Delegates Questions

  1. What’s a delegate?
       A delegate object encapsulates a reference to a method.

  2. What’s a multicast delegate?
         A delegate that has multiple handlers assigned to it.  Each assigned handler (method) is called.


XML Documentation Questions

 1. Is XML case-sensitive?
      Yes.

 2. What’s the difference between // comments, /* */ comments and /// comments?
       Single-line comments, multi-line comments, and XML documentation comments.

 3. How do you generate documentation from the C# file commented properly with a command-line compiler?
      Compile it with the /doc switch.


Debugging & Testing Questions

 1.What debugging tools come with the .NET SDK?
      1.   CorDBG – command-line debugger.  To use CorDbg, you must compile the original C# file using the /debug switch.
      2.   DbgCLR – graphic debugger.  Visual Studio .NET uses the DbgCLR.

 2. What does assert() method do?
     In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false.  The program proceeds without any interruption if the condition is true.

 3. What’s the difference between the Debug class and Trace class?
       Documentation looks the same.  Use Debug class for debug builds, use Trace class for both debug and release builds.

 4. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
       The tracing dumps can be quite verbose.  For applications that are constantly running you run the risk of overloading the machine and the hard drive.  Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.

  5. Where is the output of TextWriterTraceListener redirected?
        To the Console or a text file depending on the parameter passed to the constructor.

        6. How do you debug an ASP.NET Web application?
             Attach the aspnet_wp.exe process to the DbgClr debugger.

        7. What are three test cases you should go through in unit testing?
             1.Positive test cases (correct data, correct output).
             2.Negative test cases (broken or missing data, proper handling).
             3.Exception test cases (exceptions are thrown and caught properly).

        8. Can you change the value of a variable while debugging a C# application?
             Yes.  If you are debugging via Visual Studio.NET, just go to Immediate window.

     ADO.NET & Database Questions
  
      1. What is the role of the DataReader class in ADO.NET connections?
             It returns a read-only, forward-only rowset from the data source.  A DataReader provides fast access when a forward-only sequential read is needed.

       2. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
             SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix.  OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.

       3. What is the wildcard character in SQL?
              Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.

       4.Explain ACID rule of thumb for transactions.
          A transaction must be:
         1. Atomic - it is one unit of work and does not dependent on previous and following transactions.
         2. Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
         3. Isolated - no transaction sees the intermediate results of the current transaction).
         4. Durable - the values persist if the data had been committed even if the system crashes right after.

       5. What connections does Microsoft SQL Server support?
             Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).

       6. Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
             Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

       7. What does the Initial Catalog parameter define in the connection string?
             The database name to connect to.

       8. What is a pre-requisite for connection pooling?
             Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.  The connection string must be identical.


Assembly Questions
1.How is the DLL Hell problem solved in .NET?
    Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

      2. What are the ways to deploy an assembly?
            An MSI installer, a CAB archive, and XCOPY command.

      3. What is a satellite assembly?
             When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

      4. What namespaces are necessary to create a localized application?
             System.Globalization and System.Resources.

      5. What is the smallest unit of execution in .NET?
              an Assembly.

      6. When should you call the garbage collector in .NET?
            As a good rule, you should not call the garbage collector.  However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory.  However, this is usually not a good practice.

       7. How do you convert a value-type to a reference-type?
             Use Boxing.

       8. What happens in memory when you Box and Unbox a value-type?
              Boxing converts a value-type to a reference-type, thus storing the object on the heap.  Unboxing converts a reference-type to a value-type, thus storing the value on the stack.

  1. Which one cannot be instantiated
a.       Interface b. abstract c.both
Ans: both

      2. String is of which type.
       a. Stack   b. queue   c. array d. primitive.
       Ans: array as both are reference types

3. To append a string which one is useful?
  1. sting.format () b. string args [] c. string builder d. string. Length
Ans: String builder

4. Which modifier can be used for a member type?
a. Protected internal b. internal private. C. internal public
Ans: any of these based on the situation.(Protected internal)

5. The virtual keyword can be used for
a. class only b. Class and member c. member
Ans: member only

6. Which one is correct about the virtual keyword?
a. IT cannot be overridden
b. IT can be overridden
c. both are not true.
Ans: It can be overridden

7. The property of the Page object is private unsafe, which one can be used to access this property
a. Marshalling b. Reflection c. COM
(Could not find the Answer)

8. The advantage of Generics
a. Reusability b. Typesafe
Ans: Use generic types to maximize code reuse, type safety, and performance.

9. If one of the property is set, the ADO components can be used
a. Database b. Connect c. Data Source.

10. To change the font and color of the RichGridListBox which property is set?
a. SelectedITemColor b. SelectedItemFont c. Both d. None
Ans: Both of them.

11. The standard controls in .NET
a. AddRotator, ImageMap b. Radiobutton, Wizard c. Label, button d. All the above
Ans: All of them

12. How many dll can a .Net contain?
a. one b. two. c. three.
Ans: Any number

13. How many interfaces can a class have?
a. One interface b. multiple interface c. not even one.
Ans: multiple interfaces

14. Which one of the following is correct?
a. Private variable can be inherited
b. Private variables can be inherited but cannot be accessed.
c. Private variables cannot be inherited.
Ans: Private variables cannot be inherited.

15. Which one is the literal control?
a. Simple b. encode c. both d. none
Ans: Both

16. Table having object privileges
a. alter b. delete c. create d. all the above
Ans: Object Level Privileges are inserting, Update, delete, alter, select, index, references and execute.

17. example of system privilege
a. alter b. delete c. create d. all the above
Ans: all the above.

18. For each…. Statement supports
a. ICollection b. IEnumerable c. both d. none
Ans: ICollection and IEnumerable

19. If more than 5 parameters are used which one is preferable
a. Array. B. Enum c. Collection d. none.


  1. Which one cannot be instantiated
b.      Interface b. abstract c.both
Ans: both

      2. String is of which type.
       a. Stack   b. queue   c. array d. primitive.
       Ans: array as both are reference types

3. To append a string which one is useful?
  1. sting.format () b. string args [] c. string builder d. string. Length
Ans: String builder

4. Which modifier can be used for a member type?
a. Protected internal b. internal private. C. internal public
Ans: any of these based on the situation.(Protected internal)

5. The virtual keyword can be used for
a. class only b. Class and member c. member
Ans: member only

6. Which one is correct about the virtual keyword?
a. IT cannot be overridden
b. IT can be overridden
c. both are not true.
Ans: It can be overridden

7. The property of the Page object is private unsafe, which one can be used to access this property
a. Marshalling b. Reflection c. COM
(Could not find the Answer)

8. The advantage of Generics
a. Reusability b. Typesafe
Ans: Use generic types to maximize code reuse, type safety, and performance.

9. If one of the property is set, the ADO components can be used
a. Database b. Connect c. Data Source.

10. To change the font and color of the RichGridListBox which property is set?
a. SelectedITemColor b. SelectedItemFont c. Both d. None
Ans: Both of them.

11. The standard controls in .NET
a. AddRotator, ImageMap b. Radiobutton, Wizard c. Label, button d. All the above
Ans: All of them

12. How many dll can a .Net contain?
a. one b. two. c. three.
Ans: Any number

13. How many interfaces can a class have?
a. One interface b. multiple interface c. not even one.
Ans: multiple interfaces

14. Which one of the following is correct?
a. Private variable can be inherited
b. Private variables can be inherited but cannot be accessed.
c. Private variables cannot be inherited.
Ans: Private variables cannot be inherited.

15. Which one is the literal control?
a. Simple b. encode c. both d. none
Ans: Both

16. Table having object privileges
a. alter b. delete c. create d. all the above
Ans: Object Level Privileges are inserting, Update, delete, alter, select, index, references and execute.

17. example of system privilege
a. alter b. delete c. create d. all the above
Ans: all the above.

18. For each…. Statement supports
a. ICollection b. IEnumerable c. both d. none
Ans: ICollection and IEnumerable

19. If more than 5 parameters are used which one is preferable
a. Array. B. Enum c. Collection d. none.

20. The tag anchor is used for:
Ans: it is used for two purposes, one to book mark the page inside a html page and secondly for hyper linking external pages.

21. Can a for loop have break statement a. True b. False.
Ans: True.


6. A Try block can have?
Ans: More than one catch block

7. regsvr32.exe is also called as ------------?
Ans: ilasm.exe (doubt)

8. Syntax in CSS is?
Ans: body {color: black}

9. What is used to display the alternative text for images in web pages?
Ans: ALT

10. What is referential integrity?
Ans: Referntial integrity is a special type of relation in which the tables are related through primary key and foreign key relationship.

11. what is meant by non-clustered index?
Ans: A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.

12. what are withevents and Addhandlers?
Ans: Withevent is associated with a variable declaration for raising the events and Addhandlers are associated with handling the event at run time.

13. How do you declare a sealed class (selected a wrong choice for this question)?
Ans: Sealed class

14. Can Private variables be inherited?
Ans: They cannot be inherited. Some books and web-sites say that private variables are inherited but they cannot be accessed. If they need to be accessed, it is only through their properties.

15. What are the keywords used by to make a method overridable?
Ans: Virtual, override and abstract

16. How can we overload methods?
Ans: by changing the number of parameters, by changing the order of parameters and changing the parameters.

17. Example for Runtime polymorphism?
Ans: Method Overriding (selected a wrong choice for this question).

18. Run time polymorphism is achieved by?
Ans: Overriding (Selected a wrong choice for this question).

19. Methods that are declared as private, can they be inherited?
Ans: It cannot be inherited

20. Which of the following are false?
a) There can be only one abstract member in an abstract class
b) An abstract class must be declared with MustOverride keyword
c) An abstract class must be declared with Not Override keyword
d) All of these
(Question of Vb as MustOverride is used for methods of abstract classes)
Ans: d)

21. Arraylist stores values of different data types? True or false
Ans: True

22. The major differences between ArrayList and array are?
Ans: In Array, it is not flexible to insert or delete members but the flexibility exists in arraylist which can gracefully extend to accomodate more members.

23. The Interfaces inherited by Arraylist are?
Ans: Ienumerable, ICollections and IList.

24. The 'one to many relationship' is established by?
Ans: Splitting the data into two tables and having the foreign key referencing the primary key of another table.

25. Which of the following normal forms try to remove the non-key values if they donot have a functional dependency on the primary key?
Ans: 3NF

26. Generics is present in which of these namespaces?
Ans: System.Collections.Generic Namespace.

27. An Interface can have
a) only one abstract members
b) more than one abstract members
c) two abstract members
d) three abstract members

Ans: b)

28. You have a table by name emp and you would want to grant the permissions of insert, update and delete?
Ans: Grant insert, delete, update on emp to sami

29. you have to give permission on the table emp for all other users
Ans: Grant insert, delete, update on emp to public

30. SELECT DISTINCT city FROM SUPPLIERS will
Ans: Select all the unique CITY from the Table Suppliers.

31. You are a web developer of a company. you have developed a user control. You would like to create a template of this user control and allow other developers to reuse this control in their code. What interface would you use here?
Ans: Itemplate (doubt)

32. What do you mean by the word override?
Ans: Override means that the method can be overridden in the child class.

33. An indexer can be passed as an out and ref parameter to a method? true or false
Ans: false

34. In a ASP Web Framework, the server side validation takes place even if client side validation takes place? true or false
Ans: False (There are separate validations for client and server side).

35. Which of these have their index starting from not '0'?
Dictionary, Hashtable, keyvalue, Array
Ans :Key value (Doubt)

36. Which of the following are correct? Related to Hashtable
Ans: Doubt as felt that the question was given in vb, have submitted for review.


37. Generics was introduced in which version of .net? how is it used?
Ans: a)
a) 2.0, VS2005
b) 1.1
c) 1
d) None of these

38. Predict the output?
for delegates
Ans: Some output related to multicasting delegates.

39. Indexer output program?
Ans: Public class
    {int index this [int]
        {
           get
            {
              return propertyName;
             }
           set
            {
              propertyName=value;
            }
         }

       string index this [string]
        {
           get
            {
              return propertyName;
             }
           set
            {
              propertyName=value;
            }
         }
     }
a) This will not compile
b) It depends on the compiler
c) The compiler will compile
d) None of these


40. String input program?
Ans: string str= {"This" "is" "a" "test"}
    str [1] ="was";
    str [3] ="too";
    for (i=0; i<=str[i].length;i++)
     {
       Console.Write (str[i]+"");
     }
a) Compilation Error
b) Prints the string “This is a test"
c) Prints the string "This was a test too"
d) Doesn’t print anything

41. predict the output of the following program?
Boolean varbool = false;
if (varbool =true)
{
 
  messagebox.show ("The message is displayed")
}

a) Will not compile
b) Shows the message box
c) Will compile but doesn’t show the message box
d) None of these

Ans: b)

42. In which of the following does the change in the buttonclick depicts the location of the mouse pointer?
Ans: b)
a) ButtonClickMouseEvent
b) EventArgs
c) MouseClick Event
d) None of these

43. .Net is based on which of the following technologies?
a) Object based Technology
b) Object Oriented Technology
c) Both of a) and b)
d) None of these

Ans: b)

44. What is meant by default? what is the purpose of Default?
a) Default is an object that is permanently available in the database object
b) It is a kind of Constraint that can be used across N tables
c) Both of these
d) None of these

Ans: c) (doubt)

45. What are Hidden Fields? What is the purpose of using them?
Ans: d)
a) The Hidden Field control is used to store a value that needs to be persisted across posts to the server.
b). Normally view state, session state, and cookies are used to maintain the state of a Web Forms page.
c) This control enables a developer to store a non-displayed value.
d) All of these

46. What is the default mode of a textbox?
Ans: a)
a) Single-Line
b) Multi-line
c) Password
d) None of these

47. What is the correct syntax for the function Lower?
a) Lower (String1)
b) Lower (String1, string2)
c) Lower (String2, string1)
d) None of these

Ans: Lower (String1)

48. What are the uses of Namespaces?
Ans: For solving the naming conflict and also for using it as aliases.

49. Is ADO.NET a graphical tool that is used for forward and backward access of Data?
true or false
Ans: True.(Doubt)

50. The DLL Used for controls is?
Ans: System.Windows.Forms.

51.____________ is used for accessing remote data connection and also for locating the driver?
Ans: DataSource.

52. Size of Chars is
a) 8 bits
b) 16 bits
c) 32 bits
d) none of these

Ans: b)
http://msdn.microsoft.com/en-us/library/cc953fe1 (VS.71).aspx

53. What is the operator: ? equal to?
a) if statement
b) if...else statement
c) For statement
d) None of these

Ans: if...else statement

54. What is the scope of the variable in an if statement?
a) Procedural
b) module
c) if statement
d) program

Ans: doubt

55. What is the functionality of NAN Function?
a) Returns false if the result is a number
b) Returns true if the result is a number
c) Returns true if the result is a string regsvr32.exe is also called
d) Returns false if the result is a string
Ans: c)


1. what is the extension of the file for code behind?
Ans: aspx.cs or aspx.vb

2. A Leaf node is one which
Ans: Has no children

3. A Derived class inherits all the members and functions of a base class. Is it possible to change the behaviour of the base class?
Ans: Yes or No (doubt).

4. INSTR(c, char).Functionality of this function?
Ans: Returns the numeric position of a named character within a text field.

5. UNION means.........
Ans: The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type.

Note: With UNION, only distinct values are selected.

6. Composite Key is......
Ans: A constraint on more than one column.

7. SELECT DISTINCT city, state FROM SUPPLIERS will
Ans: Select all the unique CITY and STATE combination from the Table Suppliers.

8. Is the following XML in the correct Format?
Tove
Jani
Reminder
Don't forget me this weekend!
Ans:  No, it is not a well formed XML as the attribute date = 10/01/2008 is not enclosed in quotes like date="10/01/2008".

9. What are complex elements?
Ans: A complex element is an XML element that contains other elements and/or attributes.
There are four kinds of complex elements:
Ø     empty elements
Ø     elements that contain only other elements
Ø     elements that contain only text
Ø     elements that contain both other elements and text

10. What are default? What is the purpose of default?
Ans: Refers to a preset value. They are usually set to make the device work "out of box".

11. What does this refer to?
Ans: This refers to the current object in the context.

12. Write the output for this program?
Ans: Dim Email as String
Dim DotCom as String
Email = "Strings in C# is very easy"
DotCom = Email.Substring (5, 12)
MsgBox (DotCom)

Ans: substring(x, y) x represents the position of the character to start and y represents the number of characters to be grabbed.

i.e. gs in C# is

13. A constructor in base class......
Ans: Cannot be derived in the derived class.

14. The keyword used to derive the constructor from the base class is?
Ans: base

15. The elements in Range validator are?
Ans: Controlto validate, MinimumValue, MaximumValue

16. Which of these properties are present in Datagrid,Datalist and Repeater?
Ans:

17. If the first letter of the word and all subsequent letters of the word are capitalized, then such a naming convention is called as?
Ans: Pascal

18. What is meant by entity integrity?
Ans: entity integrity is a property that ensures that no records are duplicated and that no attributes that make up the primary key are NULL. It is one of the properties necessary to ensure the consistency of the database.

19. What is meant by multiview control?
Ans: The MultiView control acts as a container for groups of View controls. Each View control in turn contains child controls such as buttons and text boxes.

20. How to centre align a table?
Ans:
21. In VSS, Where is the file stored such that once the changes are done, it can be viewed by others?
Ans: VSS Database.
22. BCNF- Boyce Normal Form is in?
Ans: 3Normal Form
23. You are a web developer of a company. you have developed a user control. You would like to create a template of this user control and allow other developers to reuse this control in their code. What interface would you use here?
Ans: Itemplate (Doubt)
24. A class type gets stored in .........and a struct type gets stored in............?
Ans:
25. How do you add a new element in a Queue?
Ans: push ()
(Enqueue() 
http://en.csharp-online.net/Queue_class#Adding_and_Removing_Elements)
26. In which of these kind of data Structure, do you have LIFO?
Ans: Stack
27...........is used to import the contents of one style sheet into another.
Ans: xsl: Import
29. How to avoid editing the text region of the combo-box?
Ans:
30. Which of these operators are used in 'C#'?
@, in, ^, none of these.
Ans: ^
31. Foreach construct comes under which Interface?
Ans:
32. For exceptions arising due to file operations. Which of these exception classes are used?
Ans: System.IOExceptions(IO for files,system.exeption 4 namespace)
33. How do you add/Format to add Enum items in a combo-box?
Ans:
34. In what form does a picture open in its default format?
Ans:
35. Which of the following are global variables?
Ans:
36. In order to retain the information between post backs. Which of the following are used?
Ans: View State
37. what is the class above all the classes holding type?
Ans: Object
38. What is the access specifier that a destructor Holds?
Ans: Destructor doesn’t have any access specifier
39. In order to allow the implementation of a method from a base class to a derived class .What is the access specifier that should be used?
Ans:
40. How do you invoke Garbage Collector?
Ans: System.GC.Collect.
41. how to create a reference object to Garbage Collector?
Ans: System.Create.GC ()
43. Which of these namespaces is used for using pointers?
Ans: System.net, system.Reflection, None of these.
44. User Protected Right Files....Something about SS.ini Files and SSAdmin.ini Files?
45. What are Delegates?
class, Functions, properties, None of these.
Ans: Functions
46. An Abstract class has ------------- and ---------?
Abstract functions, abstract property, both, none of these.
Ans: Both
47. Does an abstract function have abstract members?
Ans: true or false, False
48. A Property is identified by its name; the indexer is identified by...........
Ans: Signature
49. An indexer is same as property except..............
Ans: accessor of an indexer corresponds to a method with the same formal parameter list as the indexer.
50. Hashtable extends from which class?
Ans: System. Collections.
51. What is meant by Delegate Co-variance?
Ans:
52. You are a developer, you are writing a code to prevent the end user to close the form. With which event should you deal with?
option: closing event, page load event etc...
Ans: Closing event
53. You have to programmatically maximize the window size, how would you do this?
Ans:
54. A certain window should not be displayed in the task bar, how would you programmatically do this?
Ans:
55. Stream operations are under the namespace?
Ans: System.IO
56. .when a derived class derives all the members of the base class. Such an inheritance is called as?
Options: implementation inheritance, interface inheritance.
Ans: Implementation inheritance
57. For an event member to be accessed, from code behind....Select the best Access Specifier?
Ans: Public
58. What are the steps involved in a wizard?
Options: navigation buttons, Wizard steps and side control etc......
Ans: All of these.
  1. Which of the following options is used to execute a .net file from command prompt?
Ans: csc
  1. When do we use remoting and when do we use web services?
Ans: use remoting for more efficient exchange of information when you control both ends of the application  
  1. The Projects that are created in .net are bundled up and created as executables in the form of?
Ans: Assemblies.
  1. Which is the root namespace for all the projects in C#?
Ans: System.
  1. The Client installs the assembly by giving which command Prompt?
Ans: GACUTIL –i
  1. An object used as reference allocates how much memory?
Ans: 16 bytes.
  1. Versioning is done for which of the following?
Ans:  Shared Assembly
  1. Which of the following method belong to System. Object?
Ø     Gettype
Ø     Clone
Ø     Tostring
Ø     Equals
       Ans: Clone
  1. What are the physical files available for a Solution?
Ans: solution, project, class; project, namespace; namespace, assembly; assembly; class solution is available as .sln, project with an extn of .csproj and class with an extension of .cs assembly is created in the bin folder with an extension of .dll or .exe and does not constitute a solution , similarly namespace is not a physical file, it is a logical collection of related classes
  1. I have created a n assembly validate Helper which is a reusable component. My friend would like to use these assemblies for validation. Which component among these should be given to him?
    Ans: Public Key
Public key which can be extracted from an already available public private key pair can be used to execute the assembly, using the public key changes cannot be made to the assembly

      15. Why should we use a SqlConnectionObject instead of an   oledbConnectionObject?

      Ans: A SqlConnection object is optimized for use with SQL Server. 

                                                                         

16. RCW stands for?
Ans: Runtime Callable Wrapper.
17. Where is the version information stored in an assembly?
Ans: Manifest
19. Which one of the following is correct?
When i install there assembly. ie assembly1.dll ,assembly2.dll and assembly3.dll using installutil command.Installutil assembly1.dll assembly2.dll assembly3.dll during installation error occurs in second one (assembly2.dll).. What happened for installation Ans: Only the first assembly is installed.
20. Initial Catalog means?
Ans: Database Name.
21. Members of SQL Command are?
Ans: Connection and Transaction
23. How many types of jit are there?
Ans: 3 types are there (pre jit, econo jit, normal jit)
24. How can we force a garbage collector to run?
Ans: Using System.GC.Collect () method, we can achieve them.
25. What are the differences between an assembly and a namespace?
Ans: Assembly: Physical Grouping of Logical units and Namespace: Logical Grouping of Classes.
26. String class ‘Equals’ is value equality or reference equality?
Ans: Value Equality
(String Compares values and not references)
28. How is DLL Hell solved?
Ans: Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.  
29. What is the significant figure of decimal?
Ans: 28
30. The Config Files in .net?
Ans: Enterprisesec, web_lowtrust, machine, security.config  
31. Authentication methods in .NET?
Ans: Windows, Forms, Passport, None/Custom Authentication.
32. What is the base class of .net?
Ans: System. Object
33. What is the hierarchy of Dataset?
Ans: System.Data.Dataset
34. How does assembly versioning prevent the dll hell?
Ans: NET allows assemblies to specify the name AND the version of any assemblies they need to run.
35. What is a delegate?
Ans: A strongly typed function pointer.
36. What is a satellite assembly?
Ans: An Assembly containing the localized resources of another assembly.
37. What compiler switch creates an xml file from the xml contents in the files of an assembly?
Ans: /doc
38. What is meant by Boxing?
Ans: Encapsulating the copy of value type in an object.
39. If a method is marked as protected internal who can access it?
Ans: Classes within the same assembly, and Classes within the same assembly, and classes derived from the declaring class asses derived from the declaring class 
40. Will it compile?
public class A { }
public class B: A { }
A a = new B;
B b = new A;
Ans: No, there is an error in "B b = new A;
1. Which of the following while loop construct is having correct syntax?
Ans:  a) While (condition= = true)
         b) While (condition (condition== true) ==true)
         c) While (condition)
         d) While (condition)
2. Which of these are post condition loops?
Ans: a) If Loop  b) Switch Loop  c) do-while Loop d) while loop
  1. A single try block can contain how many catch blocks?
Ans: a) one b) two c) More than one d) none
  1. Which of these should not be used to specify the data members?
Ans: a) Sealed b) Overrides c) Overridable d) None of these
  1. How many different types of polymorphism are there?
Ans:  a) 1 b) 2 c) 0 d) 3
6.  Which of the following are false?
a) There can be only one abstract member in an abstract class
b) An abstract class must be declared with Mustoverride keyword
c) An abstract class must be declared with Not Override keyword
d) All of these
(Question of Vb as Mustoverride is used for methods of abstract classes)
Ans: d)
7. Generics were introduced in which version of .net? how is it used?
Ans: a)
a) 2.0, VS2005
b) 1.1
c) 1
d) None of these
8.  Indexer output program?
Ans: Public class
    {int index this [int]
        {
           get
            {
              return propertyName;
             }
           set
            {
              propertyName=value;
            }
         }
       string index this [string]
        {
           get
            {
              return propertyName;
             }
           set
            {
              propertyName=value;
            }
         }
     }
a) This will not compile
b) It depends on the compiler
c) The compiler will compile
d) None of these
9. Can C# have multiple inheritance?
Ans: a) Yes b) No c) C# doesn’t have a concept of inheritance d) None of these
10. for each construct extends from which construct?
Ans: a) I Comparer b) Innumerable c) Both of these d) None of these
11. Object privileges are?
Ans: a) Alter b) Delete c) Create d) Both a and b
  1. Generics are:
Ans: a) Covariance b) Contravariance c) non-variant d) None of these
  1. If we use ___________ property, we can connect to ADO.Net control?
Ans: a) Datasource b) Connect property c) Connection Property d) none of these(connectionstring property).
  1. What is entity integrity?
Ans: Entity Integrity ensures that the data in the table follows some rules and ensures that there are no duplicate records.
15. Entity Integrity is:
Ans : a) Primary Key & Foreign Key  b)Unique Key & Primary Key c)Unique Key & Foreign Key d) Primary Key, Unique Key & Foreign Key
  1. What are the differences between Data Reader and Data Set?
Ans: Data Reader is Forward only and Dataset is used for individual structuring of the database. (Definition not precise. Please check….)
  1. XML Document can be seen through:
Ans: a) Transform Source b) XML Document c) XML Source d) None of these
  1. Definitions of Primary Key and Alternate Keys?
Ans: a) A primary key is a unique value to identify the row
        b) Generally a candidate key becomes the primary Key
        c) Usually one of the candidate key becomes the primary key and the remaining forms the alternate keys
        d) All of these
  1. How do you check the constraint on a column of the table?
Ans: SELECT
  1. Functionality of having Clause?
Ans: Generally used with ‘Group by’ clause instead of where clause to specify certain condition.
  1. What is the syntax to know the duplicate values existing in a table in the database?
Ans: SELECT First Name, Last Name , Birth Date from dbo.Employees GROUPBY First Name, Last Name, Birth Date HAVING COUNT(*) >1
  1. System. Array belongs to which class?
Ans: a) Interface b) Abstract c) Sealed d) Concrete
  1. Datagrid, Datalist, repeater belongs to which of the following namespace?
Ans: a) Web Controls, Controls b) Controls c) Web Controls d) None of these
  1. Which among these controls would you use in a web page for better performance?
Ans: a) Data Grid b) Data List c) Repeater d) All of these
25. Predict the output of the program?
Dim Email as String
Dim Dotcom as String
Email = "Strings in C# is very easy"
Dotcom = Email. Substring (5, 12)
MsgBox (DotCom)
Ans: substring(x, y) x represents the position of the character to start and y represents the number of characters to be grabbed.
I.e. gs in C# is
26. What are the keywords used by to make a method overridable?
Ans: Virtual, override and abstract
27. Which of the following is a criterion to conduct Binary Search on Array List?
Ans: a) All the Array List items should be of the same type
         b) All the Array List items should be of numeric type
         c) All the Array List items should be of string type
         d) All the Array List items should be sorted before the search.
28. Indexers can have multiple parameters? True or false
29. A Default Constructor is?
Ans: a) A Constructor that has no parameters and the method body is empty.
30. Which of the following are true?
Ans:  a) Events are directly evoked in the derived class if the events are declared as public in the base class
b)      Events aren’t directly evoked in the derived class if the events are declared as private in the base class
c)      Events are directly evoked in the derived class if the events are declared as private.
d)      Events aren’t directly evoked in the derived class if the events are declared as protected.
      31. If the normalization of the table is done with respect to removal of repeated data and if it is atomized?
      Ans: a) 1NF b) 2NF c) 3NF d) BCNF
      32. What is the main class from where all the types are derived?
      Ans: a) System b) System. Object c) Object d) All of these
  
      33. Regarding Build Class Question?
     Ans: a) Deny () b) PermitOnly () c) Assert () d) Demand ()
34. In the DomainControl UpDown How is the change event detected?
Ans: By the change in SelectedItemChanged event.
35. Which of the following commands are present in Data list control?
Ans: a) ItemCommand b) EditCommand c) ItemCreate d) All of these
36. Abstraction for the sake of Abstraction is?
Ans: a) Encapsulation b) Hiding c) Premature Generalization d) Abstraction
Which method is actually called ultimately when Console.WriteLine( ) is invoked
Ans: appendformat method()
What happens when a C#
project has more than 1 Main methods
Ans:
What does the keyword virtual mean in the method definition?
Ans: if a base class has a virtual method it means that the method must be override by the derived class using override method.
What is the difference between shadow and override
Ans: There are two main Differences between
Shadowing and Overriding. 1) Overriding redefines only the implementation but shadowing redefines the whole Element. 2)In Overriding dervied Class can refer the Base class using ME Keyword but in shadowing we can access it using "MYBase".
What is difference between deep copy & sallow copy?
Ans: Shallow and deep copy are used for copying data between
objects. Shallow Copy: creating a new object, and then copying the nonstatic fields of the current object to the new object. If a field is a value type --> a bit-by-bit copy of the field is performed If a field is a reference type --> the reference is copied but the referred object is not; therefore, the original object and its clone refer to the same object. in C# and VB.NET, shallow copy is done by the object method MemberwiseClone()
Describe the accessibility modifier protected internal.
Ans: It's available to derived classes and
classes within the same Assembly (and naturally from the base class it's declared in).

No comments:

Post a Comment