Vous êtes sur la page 1sur 38

1. a. b. c. d.

2. What a realistic modeling ? a. b. c. d. Realistic modeling is the approach to model the real world more accurately . Realistic modeling is the approach to exit in different forms. Realistic modeling is the approach of using existing classes or object from other applications. Realistic modeling is the approach to allow systems evoies.

3. Consider the following code snippet : public void func() { try{Console.WriteLine("Inside try block");} catch{Console.WriteLine("Inside catch block");} finally{Console.WriteLine("Inside finally block");} } What will be the output when the preceding function is executed ?

a. b.

Inside try block Inside try block Inside finally block

c. d.

Inside finally block Inside try block

Inside catch block Inside finally block

4. What is the use of the BinaryWriter class ? a. b. c. d. It is used to read from and write to any location within It is used to write characters to a stream It is used to write primitive data type in binary format It is used to read primitive data type from a binary stream.

5. Which of the following does NOT hold true for a delegate ? a. b. c. d. A delegate is reference type of variable , which hold the reference to method. A single-cast delegate contains an invocation list of multiple method. The method that can be referenced by a delegate are determined by the delegate declaration. A multicast delegate derives from the System.MulticastDelegate class.

6. Consider the following code : Class Vehicle { Public Vehicle() {Console.WriteLine("Inside the Vehicle class");} ~ Vehicle() {Console.WriteLine("Exiting the Vehicle class");} }

Class Car : Vehicle { Public Car() {Console.WriteLine("Inside the Car class");} ~ Car() {Console.WriteLine("Exiting the Car class");} Public static void Main() {Car obj = new Car(); } } Identify the output of the preceding code . a. Inside the Car class

Inside the Vehicle class Exiting the Car class Exiting the Vehicle class

b. Inside the Car class Inside the Vehicle class Exiting the Vehicle class Exiting the Car class

c.

Inside the Vehicle class

Inside the Car class Exiting the Car class Exiting the Vehicle class

d.

Inside the Vehicle class

Inside the Car class Exiting the Vehicle class Exiting the Car class

7. What is a constructor ? a. A constructor is a special type of struct that is invoked when you create a new instance of a class. b. A constructor is a special type of class that is invoked when you create a new instance of that class. c. A constructor is a special type of event that is invoked when you create a new instance of a class. d. A constructor is a special type of method that is invoked when you create a new instance of a class.

8. Mary has to write a program in which she want all the variables of a class to be accessible only within that class and it sub classes . Which of the following access specifier should Mary use to accomplish this task ? a. Private

b. Internal c. Protected d. Public. Answer : a

9. Anna needs to write code in C# to work with a file named Test.txt . According to the requirement , the Test.txt file should get opened as soon as the program starts executing . If Test.txt does not already exist , a new file with the same name should get create . However , if the file exist , she needs to ensure that the pointer is at the beginning of the file . Identify the correct code snippet that would enable Anna to accomplish that task . a. FileStream fs = new FileStream("Test.txt", FileMode.Open, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); Sr.BaseStream.Seek(O, SeekOrigin.Begin); String str = sr.ReadLine(); b. FileStream fs = new FileStream("Test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); Sr.BaseStream.Seek(O, SeekOrigin.End); String str = sr.ReadLine();

c. FileStream fs = new FileStream("Test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); Sr.BaseStream.Seek(O, SeekOrigin.Begin); String str = sr.ReadLine();

d. FileStream fs = new FileStream("Test.txt", FileMode.CreateNew, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); Sr.BaseStream.Seek(O, SeekOrigin.Begin); String str = sr.ReadLine(); Answer : d

10. Which of the following is NOT a comparison operator ? a. == b. != c. = d.<=

11. John needs to write a program to accept the marks of a student and display the status , pass or fail , accordingly. If the marks is less than 50 then fail should be display on the screen . Similarly , if marks is greater or equal to 50 then pass should be display . In addition, John needs to display an appropriate message if marks entered is greater than 100 . Identify the correct code that would enable John to accomplish his task. A. { Public void Status() { Console.WriteLine("Enter marks :"); Int marks = Convert.ToInt32(Console.ReadLine()); If(marks > 100) {Console.WriteLine("Marks cannot exceed 100"); } Else if(marks >= 50) {Console.WriteLine("Pass"); } Else {Console.WriteLine("Fail"); } } Public static void Main(string[] args) { Test obj = new Test(); obj.Status(); } } Class Test

B. {

Class Test

Public void Status() { Console.WriteLine("Enter marks :"); Int marks = Convert.ToInt32(Console.ReadLine()); If(marks > 100) {Console.WriteLine("Marks cannot exceed 100"); Else if(marks >= 50) {Console.WriteLine("Pass"); } Else {Console.WriteLine("Fail"); } } } Public static void Main(string[] args) { Test obj = new Test(); obj.Status(); } } C. Class Test { Public void Status() { Console.WriteLine("Enter marks :"); Int marks = Convert.ToInt32(Console.ReadLine()); If(marks > 100) {Console.WriteLine("Marks cannot exceed 100"); } if(marks >= 50)

{Console.WriteLine("Pass"); } Console.WriteLine("Fail"); } Public static void Main(string[] args) { Test obj = new Test(); obj.Status(); } } D. { Public void Status() { Console.WriteLine("Enter marks :"); Int marks = Convert.ToInt32(Console.ReadLine()); If(marks > 100) { Console.WriteLine("Marks cannot exceed 100"); Else if(marks >= 50) {Console.WriteLine("Pass");} } Else {Console.WriteLine("Fail"); } } Public static void Main(string[] args) { Test obj = new Test(); obj.Status(); } } Class Test

12. David Smith is a technical support in an international call center . David is working on software , which tells him about the ratings on his calls given by the customer . The software give the following messages , if the customer ratings is in : Range 1-4 : The customer overall dissaticfied with your support . Range 5-7 : The customer is some what saticfied with your work . Range 8-9 : The customer is very saticfied and happy with your work . Identify the programming construct implemented in the preceding software . a. b. c. d. Switch case construct Do while loop construct Nested if else construct While loop construct

13. Which of section handlers , used by the .NET Framework , returns a hash table containing name/value setting ? a. SingleTegSectionHandler. b. IgnoreSectionHandler c. NameValueSectionHandler d. DictionatySectionHandler Answer: c

14. You want to create a strong-named assembly. You have already generated a public/private key pair by using strong naming utility,sn.exe. Now rearrange the following steps in a sequence in which they needs to be performed , to create to strong named assembly . 1, 2, 3, 4, 5, 6, a. Open you project in Visual Studio .NET . Click the Signing Property page Open the Properties page for your project in the Solution Explorer window . Click the drop-down list and select Strong Name KeyFile . Select the Sign the Assembly check box . Build the project . 1--> 2 -- > 5 --> 3 --> 4 --> 6 .

b. c. d.

1--> 3 --> 2 --> 5 --> 4 --> 6 . 1--> 3 --> 5 --> 4 --> 2 --> 6. 1--> 2 --> 3 --> 5 --> 4 --> 6 .

Answer : d

15. You needs to create a data during installation . Which editor would you use ? a. b. c. d. Custom Actions Editor Launch Conditions Editor User Interface Editor File Types Editor

16. __________ template is used to create a single pack age containing all the files , resources, registry entries, and the setup logic necessary for deploying a component. a. b. c. d. Setup Project Merge Module Project Web Setup Project Cad Project

17. You create a form containing a LinkLabel control, IIConnect. When a use click the LinkLabel control, a browser window should open with the www.yahoo.com.page. Which of the following statements can you use to perform the above task ? a. b. c. d. System.Start("http://www.yahoo.com") System.Diagnostics.Start("http://www.yahoo.com") Process.Diagnostics.Start("http://www.yahoo.com") System.Diagnostics.Process.Start("http://www.yahoo.com")

18. Sam is creating an application, On a Windows form, he has added a button control, named btnDelete. He want to display a tool tip for the button control displaying a message, "Delete a Record". He has written the following code to perform this activity. ToolTip ttDelete = new ToolTip();

ttDelete.ToolTipText = "Delete a record" ttDelete.SetToolTip(btnDelete); On building the application the receives a compile time error in the above mentioned code. How this error can be corrected? a. The error can be corrected by modifying the given code as:

ToolTip ttDelete = new ToolTip(); ttDelete.ToolTipText = "Delete a record" ttDelete.SetToolTip(ttDelete, btnDelete);

b.

The error can be corrected by modifying the given code as:

ToolTip ttDelete = new ToolTip(); ttDelete.SetToolTip("Delete a record", btnDelete);

c.

The error can be corrected by modifying the given code as:

ToolTip ttDelete = new ToolTip(); ttDelete.ToolTipText = "Delete a record" tt.SetToolTip(btnDelete);

d.

The error can be corrected by modifying the given code as:

ToolTip ttDelete = new ToolTip(); ttDelete.SetToolTip(btnDelete, "Delete a record");

19. A user wants to create a component that controls the communication with the database and it can be shared by different applications. Which of the following type of component he should create ? a. In-Process and Visual component b. Out-of-Process and Nonvisual component c. In-Process and Nonvisual component d. Out-of Process and Visual component

20. Which type of components responds faster, in-Process components or out-of-process components? a.The response time depends on the operating system the user is using b. Out-of-process component. c. Both the components take the same time. d. In-process component. 21. What steps will you perform to ensure that a menu with the Open and Edit menu option os displayed when a user right-click a form ? a. 1,Drag the MenuStrip control to the form and set its name property to cmMenu1. 2, Add the menu items to the MenuStrip. 3, Set the MainMenuStrip property of the form to True. b. 1,Drag the ContextMenuStrip control to the form and set its name property to cmMenu1. 2, Add the menu items to the context menu. 3, Set the ContextMenuStrip property of the form to True. c. 1,Drag the ContextMenuStrip control to the form and set its name property to cmMenu1. 2, Add the menu items to the MenuStrip. 3, Set the ContextMenuStrip property of the form to cmMenu1. d. 1,Drag the MenuStrip control to the form and set its name property to cmMenu1. 2, Add the menu items to the MenuStrip. 3, Set the MainMenuStrip property of the form to cmMenu1. 22. Sam is developing an application. He want to write code to play a wave file on the Click event of a Button control, named btnPlay. The name of the wave fileto be played is alresdy stored in a string variable, named MusicFile. Due to large size of the wave file, the wants that the file should be loaded asynchronously in the background. Which of the following option gives the correct code to perform this activity? a. Using System.Media ............ Private void btnPlay_Click(object sender, EventArgs e) { SoundPlayer sp = SoundPlayer.LaodAsync(MuczicFile); Sp.Play();

} b. Using System.Media ............ Private void btnPlay_Click(object sender, EventArgs e) { SoundPlayer sp = new SoundPlayer.LaodAsync(MuczicFile); Sp.Play(); } c. Using System.Media .................. private void btnPlay_Click(object sender, EventArgs e); { SoundPlayer sp = new SoundPlayer(); sp.LoadAsync(MisicFile); sp.Play(); } d.Using System.Media ................... Private void btnPlay_Click(object sender, EventArgs e) { SoundPlayer sp = new SoundPlayer(MuczicFile); Sp.PlayAsync(); } 23. Which of the following control can be used to display a special menu whenever user clicks the right mouse button ? a. ToolStrip control b. ContextMenuStrip control c. StatusStrip control

d. MenuStrip control.

24. A user wants to create a custom dialog box by using Designer. What change he needs to incorporate in the application to create a custom dialog box ? a. User needs to incorporate following change : Assign a value of CustomDialog to the FormBorderStyle property of the form. Assign a value of False to ControlBox, MinimizeBox, and MaximizeBox properties of teh form. Assign an appropriate value to the FixedDialog property for each button used on the form.

b. User needs to incorporate following change : Assign a value of FixedDialog to the FormBorderStyle property of the form. Assign a value of True to ControlBox, MinimizeBox, and MaximizeBox properties of teh form. Assign an appropriate value to the DialogResult property for each button used on the form.

c. User needs to incorporate following change : Assign a value of FixedDialog to the FormBorderStyle property of the form. Assign a value of False to ControlBox, MinimizeBox, and MaxximizeBox properties of teh form. Assign an appropriate value to the DialogResult property for each button used on the form.

d. User needs to incorporate following change : Assign a value of CustomDialog to the FormBorderStyle property of the form. Assign a value of True to ControlBox, MinimizeBox, and MaximizeBox properties of teh form. Assign an appropriate value to the DialogResult property for each button used on the form.

25. Sam is assigned a task to write a program that displays a list of all the file present in a particular directory. He needs to diaplay the name of the file, size of that file, and the extension of that file. Write the code that would enable Sam to accomplish his task. a. DirectoryInfo Mydirinfo = new DirectoryInfo(@"C:\myDirectory");

FileInfo[] FilesInDir = MydirInfo.GetFiles();

foreach(FileInfo file in MydirInfo) { Console.WriteLine("File Name:{0} Size:{1} bytes Extension:{2}", file.Name, file.Length, file.Extension); } Console.ReadLine();

b.

DirectoryInfo Mydirinfo = new DirectoryInfo(@"C:\myDirectory");

FileInfo[] FilesInDir = MydirInfo.GetFiles(); foreach(FileInfo file in FilesInDir) { Console.WriteLine("File Name:{0} Size:{1} bytes Extension:{2}", MydirInfo.Name, MydirInfo.Length, MydirInfo.Extension); } Console.ReadLine();

c.

DirectoryInfo Mydirinfo = new DirectoryInfo(@"C:\myDirectory");

FileInfo[] FilesInDir = FilesInDir.GetFiles(); foreach(FileInfo file in FilesInDir) { Console.WriteLine("File Name:{0} Size:{1} bytes Extension:{2}", file.Name, file.Length, file.Extension); } Console.ReadLine();

d.

DirectoryInfo Mydirinfo = new DirectoryInfo(@"C:\myDirectory");

FileInfo[] FilesInDir = MydirInfo.GetFiles(); foreach(FileInfo file in FilesInDir)

{ Console.WriteLine("File Name:{0} Size:{1} bytes Extension:{2}", file.Name, file.Length, file.Extension); } Console.ReadLine();

26. Which of the following class is used to create a dialog box that can be used to select a folder to save or open a file? a. ForderBrowserDialog Class b. OpenFileDialog Class c. SaveFileDialog Class d.FileDialog Class

27. Consider the following statements: Statement A. All custom controls inherit from the System.Windows.Form.CustomControl class Statement B. To define the visual appearance of a custom control Paint() method needs to be overridden. Which of the following option is correct with regard to the above mentioned statements ? a. b. c. d. Statement A and Statement B are False. Statement A is True and Statement B is False. Statement A is False and Statement B is True. Statement A and Statement B are True.

28.Which of the following statement correctly describes Dock property of the StatusStrip control ? a. Dock property of the StatusStrip control defines a collection of items to be displayed on the control. b. Dock property of the StatusStrip control defines which borders of the control are bound to the container. c. Dock property of the StatusStrip control specifies the layout orientation of the control. d. Dock property of the StatusStrip control specifes whether the control will autom atically size itself to fit its contents.

29. Ivan is writing code to display a message box on the click event of button. The message box will display a warning message to the user with Yes,No, and Cancel button. He writes the following code to display the message box. Private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Do You want to continue","File Save"); MessageBoxlcon.Warning, MessageBoxButton.YesNoCancel); } When Ivan run this code, compile time error has occurred. How this error can be corrected. a. Ivan should modify the given code as :

Private void button1_Click(object sender, EventArgs e) { MessageBox.ShowMessage("Do You want to continue","File Save"); MessageBoxlcon.Warning, MessageBoxButton.YesNoCancel); } b. Ivan should modify the given code as :

Private void button1_Click(object sender, EventArgs e) { MessageBox.ShowMessage("Do You want to continue","File Save"); MessageBoxButton.YesNoCancel, MessageBoxlcon.Warning); } c. Ivan should modify the given code as :

Private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Do You want to continue","File Save"); MessageBoxButton.YesNoCancel, MessageBoxlcon.Warning,); } d. Ivan should modify the given code as :

Private void button1_Click(object sender, EventArgs e) { MessageBox.Display("Do You want to continue","File Save"); MessageBoxlcon.Warning, MessageBoxButton.YesNoCancel); }

30. Hary is developing a .NET application using Visual C#. He adds a Windows form to the application. To specify the position of the Window form on the screen, he decides to set the StartPosition property of this form. He wants that the form should be displayed at the Window default location and its dimension should be same as specified in the in Size property of the form. Which of the following value of Startposition property, he should set to fulfill his requirement? a. Manual. b. CenterScreen. c. WindowsDefaultBounds. d.WindowsDefaultLocation. Answer: d

31. Which of the following statement correctly described DragDrop even of the drag-and-drop operation? a. DragDrop event is triggered on the completion of the drap-and-drop operation. b. DragDrop event is triggered when a user drags an item out of the control's boundaries. c. DragDrop event is triggered when a user drags an item onto the control's boundaries. d. DragDrop event is triggered when a user drags an item while the mouse pointer is within the limits of the control's boundaries.

32. A cross-platform, hardware and software independent markup language that enable you to store data in a structured form at by using meaningful tags that can be interpreted by any computer system is_ _ _ _ _ _ _ _ _ . a. DHTML b. HTML c. JavaStrip d. XML

33. Henry has developed a method to convert a given currency into another currency. He wants to expose this method in a Web service. Which attribute should Henry use to accomplish this task ? a. DllImport b. Obsolete c. WebMethod d. Conditional

34. The following code is written to create a thread : using System; using System.Threading;//line1 namespace t { class thread_demo { public static void child() {} public static void Main()//line 2 { Thread static obj = new ThreadState(child);// line 3 Thread obj1 = new thread(obj);//line 4 obj1.Start(); } Find the first line in the code due to which the thread is not created and modify that line. a. Error is in line 2. It should be :

public static void Main(string[] args) b. Error is in line 3. It should be :

ThreadStart obj = new ThreadStart(child); c. Error is in line 1, It should be :

using System.Thread; d. Error is in line 4. It should be :

Thread obj1 = new Thread(child); Answer : a 35. What is the purpose of the Thread.Sleep() method? a. It terminates the thread.

b. It makes the thread to pause for a period of time. c. It starst the thread. d. It suspends a thread. Answer : a

36. Consider the following statements: Statement A: To add the reference of the built-in components, you the can select Choose Items option from the View Menu. Statement B: The built-in component can be selected from the COM Components tab of Choose Toolbox Items dialog box Which of the following is true, with respect to the above statements? a. b. c. d. Statement A is True and Statement B is False Statement A and Statement B are False Statement A is False and Statement B is True Statement A and Statement B are True

37.Which of the following is NOT a part of a funtion signature ? a. b. c. d. Sequence of parameters Data type of parameters Run type of parameters Number of parameters

38. Which of the following holds true for encapsulation? a. Encapsulation is defined as the process of viewing the relevant information to the user. b. Encapsulation is defined as the process of looking for what you want in an object or a class. c. Encapsulation is defined as the process of enclosing one or more items within a physical or logical package. d. Encapsulation is defined as the process of allowing access to nonessential details.

39. Which method is used to display text on the screen ?

a. ReadLien() b. Read() c. SerOut() d. WriteLine()

40. John needs to write a program for file handling. He wants to open a particular file during program execution. However, if that file does not exits, a new file should get created. Which FileMode enumerator should John use in the contructor of the fileStrean class? a. Create b. OpenOrCreate c. Open d. CreateNew

41. Which class acts as the base class for all the predefined system exception? a. System.Exception b. System.ApplicationException c. System.SystemException d. System.AppDomainUnloadedException

42. What is a destructor? a. Destructor is a static method that is used to release the instance of a class from memory. b. Destructor is an event that is used to release the instance of a class from memory. c. Destructor is a method that is used to release the instance of a class from memory. d. Destructor is a delegate that is used to release the instrance of a class from memory.

43. Consider the following code snippet: class Calculate { int num1,num2; public Calculate()

{ num1=25; num2=15; } public void initialize() { num1=15; num2=25; } public static void Main(string[] args) { Calculate obj = new Calculate(); obj.num1=10; obj.num2=20; obj.initialize();}} What will be the valua of num1 and num2 after executing the preceding code snippet? a. num1=25 num2=15 b. num1=15 num2=25 c.num1=20 num2=10 d.num1=10 num2=20

44. Which of the following does NOT hold true for contructors? a. Static contructors are used to initialize non-static variables of a class. b. Instance constructors are used to initialize data members of the class. c. Static constructors have an implicit private access. d. Instance constructors is called whenever an instance of a class is created.

45. John is assigned a task to write a program to calculate the factorial of a number. The number needs to be accepted from the user at runtime. To accomplish this task, John decides to create a recursive function, fact, that calculate the factorial of the given number. He has written the following code snippet: Class Test { Public void fact(int n) { int result; If(n == 1) {return 1;} Else { Result = fact(n - 1)*n; Return result; }} Static void Main(string[] args) { Test obj = new Test(); Console.WriteLine(Enter a number: ); Int num= Convert.ToInt32(Console.ReadLine()); Int result = obj.fact(num); Console.WriteLine(The factorial is : + result); }} However, the preceding code gives a compile time error. Identify the correct code snippet. a. Class Test { Public void fact(int n) { int result; If(n == 1) {return 1;} Else { Result = fact(n - 1)*n; Return result; }} Static void Main(string[] args) { Test obj = new Test(); Console.WriteLine(Enter a number: ); int num= Convert.ToInt32(Console.ReadLine()); int result = obj.fact(num); Console.WriteLine(The factorial is : + result); }} b. Class Test { Public void fact() { Console.WriteLine(Enter a number: ); int num= Convert.ToInt32(Console.ReadLine()); int result; If(num == 1) {return 1;} Else { Result = fact()*num - 1; Return result; } Console.WriteLine(The factorial is : + result); } Static void Main(string[] args) { Test obj = new Test(); }} c. Class Test { Public void fact(int n)

{ int result; If(n == 1) {return 1;} Else { Result = fact(n - 1)*n; Return result; }} Static void Main(string[] args) { Test obj = new Test(); Console.WriteLine(Enter a number: ); int num= Convert.ToInt32(Console.ReadLine()); Console.WriteLine(The factorial is : + obj.fact(num)); }} d. Class Test { Public void fact(int n) { int result; If(n == 1) {return 1;} Else { Result = fact(n - 1)*n; } Console.WriteLine(The factorial is : + result); } Static void Main(string[] args) { Test obj = new Test(); Console.WriteLine(Enter a number: ); int num= Convert.ToInt32(Console.ReadLine()); obj.fact(num); }} Answer : d 46. Predict the output of the following code snippet: Public static void Main() { Int I = 0; FileStream fs = new FileStream(C:\\Preeti\\Myfile.txt, FileMode.open, FileAccess.Read); StreamReader sr = new StreamReader(fs); Sr.BaseStream.Seek(0, SeekOrigin.Begin); FileStream fs1 = new FileStream(C:\\Preeti\\Myfile.txt,FileMode.CreateNew, FileAccess.Write); StreamWrite sw = new StreamWrite(fs1); While((i=sr.Read()) != -1) { Sw.Write(Convert.ToChar(i+1)); } Sr.Close(); Sw.Close(); } a. It is reading the source file character by character and writing alternate characters in the target file.

b. It is reading the source file character by character and writing each character by incrementing its ascii value by 1 in the target file. c. It is reading the source file character by character and writing each character in the target file. d. It is reading the source file character by character and writing each character twice in the target file. Answer : b 47. Which function is used to convert a given data element to the int data type? a. Convert.ToInt32() b. Convert.toInt32() c. Convert.ToInt() d. Convert.Toint32() Answer : a 48. Mary has been assigned a task to write a program in C# that displays the name of the week day after accepting the week number from the user. For example, if the user enters 1 the Sunday should get displayed on the screen. Identify the correct code snippet that would enable Mary to accomplish her task. a. Console.WriteLine(Enter the week number:); int num= Convert.ToInt32(Console.ReadLine()); switch(num) { Case 1 : Console.WriteLine(Sunday); break; Case 2 : Console.WriteLine(Monday); break; Case 3 : Console.WriteLine(Tuesday); break; Case 4 : Console.WriteLine(Wednesday); break; Case 5 : Console.WriteLine(Thursday); break; Case 6 : Console.WriteLine(Friday); break; Case 7 : Console.WriteLine(Saturday); break; } b. Console.WriteLine(Enter the week number:); int num= Convert.ToInt32(Console.ReadLine()); switch() { Case 1 : Console.WriteLine(Sunday); break; Case 2 : Console.WriteLine(Monday); break; Case 3 : Console.WriteLine(Tuesday); break; Case 4 : Console.WriteLine(Wednesday); break; Case 5 : Console.WriteLine(Thursday); break; Case 6 : Console.WriteLine(Friday); break; Case 7 : Console.WriteLine(Saturday); break } c. Console.WriteLine(Enter the week number:); int num= Convert.ToInt32(Console.ReadLine()); switch(num) { Case 1 : Console.WriteLine(Sunday); break; Case 2 : Console.WriteLine(Monday); break;

Case 3 : Console.WriteLine(Tuesday); break; Case 4 : Console.WriteLine(Wednesday); break; Case 5 : Console.WriteLine(Thursday); break; Case 6 : Console.WriteLine(Friday); break; Case 7 : Console.WriteLine(Saturday); break; } d. Console.WriteLine(Enter the week number:); int num= Convert.ToInt32(Console.ReadLine()); Case 1 : Console.WriteLine(Sunday); break; Case 2 : Console.WriteLine(Monday); break; Case 3 : Console.WriteLine(Tuesday); break; Case 4 : Console.WriteLine(Wednesday); break; Case 5 : Console.WriteLine(Thursday); break; Case 6 : Console.WriteLine(Friday); break; Case 7 : Console.WriteLine(Saturday); break; Answer : b 49. Consider the following code snippet: Class Medicine { Public static void Main(string[] args) { String 1Medicine_Name; Double Medicine_Price; Console.WriteLine(Enter the name of the medicine); 1Medicine_Name = Console.ReadLine(); Console.WriteLine(The price of the medicine is Rs. 50); Console.ReadLine(); } } When the preceding code is executed, it shows error. Identify the error in the preceding code. a. The variable 1Medicine_Name is invalid. b. The variable Medicine_Price is invalid. c. The data type used with the variable 1Medicine_Name is invalid. d. The data type used with the variable Medicine_Price is invalid. Answer : c 50. Which arithmetic operator is used to divide two numbers and return the remainder? a. \ b. ^ c. % d. / Answer: c

51. You want to set the security policy that applies to all the code that rurs on a particular computer. Which policy level you will use to set such security policy? a. Machine b. Application c. User d. Enterprice 52. Which of the following is NOT an element of an assembly? a. Manifest b. Resources c. EXE Code d. MSIL code 53. A question was given in an assignment to explain the concept of operator overloading. So, a student has written the following code. But the code is generating an error. Using System; Namespace OperatorOverload { Struct emp { Public int id; Public emp(int i); { This.id=i; } Static public emp operator ++(emp e) { E=id++; Return e; } } Class over_demo { Static void Main(string[] args) { Emp e1 = new emp(103); Emp e2 = ++e1; Console.WriteLine(e1.id); Console.WriteLine(e1.id); Console.ReadLine(); } } } Which of the following code snippet will help the student remove that error? a. Struct emp {

Public int id; Public emp(int i) { This.id=i; } Static public emp operator ++(emp e) { e.id++; return e; } } b. Struct emp { Public int id; Public emp(int i) { This.id=i; } Static public operator ++(emp e) { e.id++; return e; } } c. Struct emp { Public int id; Public emp(int i) { This.id=i; } Static public emp operator ++(emp e) { ++e.id; return e; } } d. Struct emp { Public int id; Public emp(int i) { This.id=i++; } Static public emp operator ++(emp e) {

e.id++; return e; } } Answer : d 54. A form has a button cmdCommand1, which when clicked must display another form named frmNext. Which of the following statements will you write in the Click event of the cmdCommand1 button? a. frmNext.Show(); b. frmNext frmObj = new frmNext(); frmObj.Show(); c.Show (frmNext); d. frmNext frmObj; frmObj.Show() Answer : d 55. Sam is creating an application. He wants that form atting of elements in the application should be done according to the en-US culture, but the date separator, string used to separate the date information, should be used as - in spite of date separator used by en-US culture. He writes the following code to perform this activity. Using System.Globalization; Using System.Threading; Cultureinfo AppCulture = new Cultureinfo(en-US); AppCulture.DateTimeFormat.DateSeparator = -; CurrentThread.CurrentCulture= AppCulture; On building this application he finds compile time error in the above mentioned code. How this error can be corrected? a. The error can be corrected by modifying the given code as: Using System.Globalization; Using System.Threading; CulturIinfo AppCulture = new CultureInfo(en-US) AppCulture.DateTimeFormat.DateSeparator = -; CurrentThread.CurrentCulture= AppCulture; b. The error can be corrected by modifying the given code as: Using System.Globalization; Using System.Threading; CultureInfo AppCulture = new CultureInfo(en-US) AppCulture.DateTimeFormat.DateSeparator = -; Thread.Current Thread.Culture= AppCulture; c. The error can be corrected by modifying the given code as:

Using System.Globalization; Using System.Threading; CulturIinfo AppCulture = new CultureInfo(en-US) AppCulture.DateFormat.DateSeparator = -; CurrentThread.CurrentCulture= AppCulture; d. The error can be corrected by modifying the given code as: Using System.Globalization; Using System.Threading; CulturIinfo AppCulture = new CultureInfo(en-US) AppCulture.DateTimeFormat.DateSeparator = -; Thread.Current Thread . Current Culture= AppCulture; Answer : a 56. Which of the following statement correctly describes the CurrentCulture property of the CultureInfo class? a. CurrentCulture property return the full name of the culture in the <Language code>-<Countru/Region code> format. b. CurrentCulture property return an instance of the CultureInfo class that represents the culture for the current thread. c. CurrentCulture property return an instance of the CultureInfo class that represents the culture for the culture-specific resources. d. CurrentCulture property return the name of the culture in the <Language code>-<Countru/Region code> format. Answer : c 57. The total memory allocated to an application by windows is called _ _ _ _ _ _ _ _ . a. Host application b. Constructor c. Components d. application space Answer : b 58. You created a form named frmMainMenu. You also added a ContextMenuStrip control named cmMenu1 to frmMainMenu. When a user right-click frmMainMenu, the context menu must be displayed. When a user select the View option from the context menu, another form named frmView must be displayed as the child form of frmMainMenu. Which of the following option will help you achieve this? a. Set the IsMdiContainer property of frmMainmenu to True. Set the ContextMenuShip property of frmView to cmMenu1. Add the following code to the event handler for the Click event of the View menu option: frmView frmObj= new frmView();

frmObj.MdiParent = this; b. Set the IsMdiContainer property of frmView to True. Set the ContextMenuShip property of frmView to True. Add the following code to the event handler for the Click event of the View menu option: frmView frmObj= new frmView(); frmObj.MdiParent = this; frmObj.Show(); c. Set the IsMdiContainer property of frmMainmenu to True. Set the ContextMenuShip property of frmMainMenu to True Add the following code to the event handler for the Click event of the View menu option: frmView frmObj= new frmView(); frmObj.MdiParent = this; frmObj.Show(); d. Set the IsMdiContainer property of frmMainmenu to True. Set the ContextMenuShip property of frmMainMenu to cmMenu1. Add the following code to the event handler for the Click event of the View menu option: frmView frmObj= new frmView(); frmObj.MdiParent = this; Answer : c 59. You want to insert a cross tab in Crystal Reports. Which of the following option gives the correct steps to perform this activity? a. 1, Right-click Report Designer and select Insert and then Cross-Tab from the shortcut menu. 2, Click the Details section of the Report Designer to create a cross tab. 3, Specify the files to be displayed as rows, columns, and summarized files under the Cross-Tab tab in the Cross-Tab Expert dialog box. 4, Specify the style for the grid to display the data under the Customize Style tab. 5, Specify the background color for rows and columns of the grid under the Style tab. b. 1, Right-click Report Designer and select Insert and then Cross-Tab from the shortcut menu. 2, Click the Report Header section of the Report Designer to create a cross tab. 3, Specify the files to be displayed as rows, columns, and summarized files under the Cross-Tab tab in the Cross-Tab Expert dialog box. 4, Specify the style for the grid to display the data under the Style tab. 5, Specify the background color for rows and columns of the grid under the Customize Style tab. c. 1, Right-click Report Designer and select Insert and then Cross-Tab from the shortcut menu. 2, Click the Report Header section of the Report Designer to create a cross tab. 3, Specify the files to be displayed as rows, columns, and summarized files under the Data tab in the Cross-Tab Expert dialog box. 4, Specify the style for the grid to display the data under the Customize Style tab. 5, Specify the background color for rows and columns of the grid under the Style tab. d. 1, Right-click Report Designer and select Insert and then Cross-Tab from the shortcut menu. 2, Click the Details section of the Report Designer to create a cross tab.

3, Specify the files to be displayed as rows, columns, and summarized files under the Data tab in the Cross-Tab Expert dialog box. 4, Specify the style for the grid to display the data under the Style tab. 5, Specify the background color for rows and columns of the grid under the Style tab. Answer : c 60. Which of the following event can be used to alert a user about the completion of a print job? a. StopPrint b. EndPrint c. CancelPrint d. ExitPrint Answer: a 61. John is creating an MDI application. The application contains an MDI parent form named deprDetails and an MDI child form frmSales. Now he wants that when a user click the menuSales menu item on the deptDetails from than the frmSales from should be displayed. Which of the following code option will perform the desired operation? a. private void menuSales_Click(object sender. EventArgs e) { frmSales objSales = new frmSales(); objSales.MdiParent = deptDetails; objSales.Show(); } b. . private void menuSales_Click(object sender. EventArgs e) { frmSales objSales = new Form(frmSales); objSales.MdiParent = this; objSales.Show(); } c. . private void menuSales_Click(object sender. EventArgs e) { frmSales objSales = new frmSales(); objSales.MdiParent = this; objSales.Show(); } d. . private void menuSales_Click(object sender. EventArgs e) { frmSales objSales = new frmSales(); objSales.MdiParent = this; objSales.Show(); } Answer: c

62. John has to write a program to implement a division operation. He needs to ensure that the program does not terminate abruptly in the event of any error during runtime. Therefore, he decides to implement userdefined exception handing in his code. Write a code for John that would enable him to accomplish his task. a. class Test { Static void Main(string[] args) { myClass obj= new myClass(); try {obj.calculate(); } catch (myException e) {Console.WriteLine(e.ToString()); } Console.ReadLine(); }} Public class myException { public myException(string message) { } } Public class myClass { Public void calculate() { Console.WrieLine(Enter number1:); Int num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Enter number2 : ); Int num2 Convert.ToInt32(Console.ReadLine()); If(num2==0) Throw (new myException(Divisor should not be zero)); Else { //Implementation }}} b. class Test { Static void Main(string[] args) { myClass obj= new myClass(); try {obj.calculate(); } catch (myException e) {Console.WriteLine(e.ToString()); } Console.ReadLine(); }} Public class myException : ApplicationException { public myException(string message): base(message) { } } Public class myClass { Public void calculate() { Console.WrieLine(Enter number1:); Int num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Enter number2 : );

Int num2 Convert.ToInt32(Console.ReadLine()); If(num2==0) Throw (new myException(Divisor should not be zero)); Else { //Implementation }}} c. class Test { Static void Main(string[] args) { myClass obj= new myClass(); try {obj.calculate(); } catch (myException e) {Console.WriteLine(e.ToString()); } Console.ReadLine(); }} Public class myException : ApplicationException { public myException(string message): base(message) { } } Public class myClass { Public void calculate() { Console.WrieLine(Enter number1:); Int num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Enter number2 : ); Int num2 Convert.ToInt32(Console.ReadLine()); If(num2==0) Throw (new myException(Divisor should not be zero)); Else { //Implementation }}} d. . class Test { Static void Main(string[] args) { myClass obj= new myClass(); try {obj.calculate(); } catch (myException e) {Console.WriteLine(e.ToString()); } Console.ReadLine(); }} Public class myException : Exception { public myException(string message): bass(message) { } } Public class myClass {

Public void calculate() { Console.WrieLine(Enter number1:); Int num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Enter number2 : ); Int num2 Convert.ToInt32(Console.ReadLine()); If(num2==0) Throw (new myException(Divisor should not be zero)); Else { //Implementation }}} Answer : c 63. Which of the following controls you need to add to the form to invoke the default Print dialog box? a. PrintDocument and PrintPreviewDialog b. PrintDialog and PrintPreviewDialog c. . PrintDialog and PrintDocument d. PaseSetupDialog and PrintPreviewDialog Answer: c 64. Consider the following two statements: Statement A : GetCultures method of the CultureInfo class returns the current culture used by the application. Statements B : GetFromat method of the CultureInfo class returns an object that represents the format of a specified type. Which of the following option is correct with regard to the above mentioned statements? a. Statement A is False and Statement B is True. b. Both Statement A and B are True. c. Statement A is True and Statement B is False d. Both Statement A and B are False Answer : b 65. Which type of project is created by selecting the Class Library template in Microsoft Visual Studio? a. Class Library template create a console application that can run from the command prompt. b. Class Library template create a class or a reusable component (.dell or .exe) that exposes some functionality to be used in various projects. c. Class Library template create an application with a Windows user interface. d. Class Library template create a custom control that can be added to the user interface. Answer : c 66. Ivan is creating a Windows form named form1 for an application. He want to add a Button control named button1 in the form at the run time. He also wants to add a click event for the button1, which should display

a message box with the message Button Clicked when the user clicks the button. He adds the following code in the form1 class to perform this activity. Button button1 = new Button(); Private void Form1_Load(object sender, EventArgs e) { Button1.Text = Click me; This.Control.Add(button); } Public Form1() { InitializeComponent(); } Private void button1_Click(object sender, EventArgs e) { MessageBox.Show(Button Clicked); } When Ivan runs the application and clicks the button1, No Message box is displayed. How this error can be corrected? a. Create the instance of the Button control inside the Form1_Load method in place of outside the Form1_Load method. b. Use Message.Show() method in place of MessageBox.Show() method in the button1_Click () event. c. Add the following code beneath the InitializeComponent() line of the code in the Form1() constructor. Button1.Click += new EventHandler(button1_Click); d. Use Form.Control.Add(button1); code line in place of this.Controls.Add(button1); code line in the Form1_Load event. Answer : d 67. Which of the following statements correctly describes the system modal dialog box? a. A system modal dialog box allows a user to switch focus to another area of the application. Which has invoked the dialog box. However, the user can not switch to other windows application. b. A system modal dialog box takes control of the entire Windows environment. User is not allowed to switch to, or interact with, any other Windows application. c. A system modal dialog box does not allows a user to switch focus to another area of the application, which has invoked the dialog box. However, the user can not switch to other windows application. d. A system modal dialog box allows a user to switch focus to another area of the application. Which has invoked the dialog box. User can also switch to another Windows application. Answer : d 68. _ _ _ _ _ _ _ _ _ can be used to transfer structured data between heterogeneous systems. a. CLR b. MSIL c. XML d.URL.

Answer : b 69. Mary has instantiated a thread to perform some I/O related task. She has not called the Start() method on that thread yet. Which state is the thread currently in? a. Not Runnable b. Unstarted c.Runnable d.Dead. Answer : c 70. Consider the following statements : Statement A : To display a crystal report in the CrytalReportViewer control, the report needs to be bound to the CrystalReportViewer control. Statement B : The ReportSource property of the CrystalReportViewer control is used to display the selected crytal report. Which of the following is true, with respect to the above statements? a. Both, Statement A and Statement B , are True. b. Statement A is False and Statement B is True. c. Both, Statement A and Statement B , are False. d. Statement A is True and Statement B is False. Answer : b