Test Engine Q3 Soft
1. What is the purpose of public access specifier? (1đ)
A. The public access specifier allows a class ...
B. It opens the file if it exists and places the
     cursor at the end of file, or creates a new file.
  C. It opens only...
A. public class Test

     {
         public delegate void myDelegate(String s);
         public static string accept(stri...
public delegate void myDelegate(String s);
            public static void accept(string str)
            {
               ...
display(d1);
               display(d2);
           }
       }



  7. Which of the following does NOT hold true for const...
Your favorite book is The trail of years


Your age is 17

Your favorite book is The trail of years

Hello Sam



Your age...
public CustomerRecordNotFound(string message) :
base(message)
    {
    }
}


public class CustomerRecordNotFoundException...
the pointer is at the beginning of the file. Identify the correct
     code snippet that would enable Anna to accomplish t...
{
              Console.Write(i + "t");
          }
      }
      public static void Main(string[] args)
      {
         ...
public void Display()
        {
            for (int i = 1; i <= range; i++)
            {
                Console.Write(i...
When the preceding code is executed, it show error. Identify the error
in the preceding code.

  A. The data type used wit...
1.Select View  File System  Registry to open the Registry Editor.

2.Select one of the top-level key nodes in the Regist...
C. A False and B True.
  D. A True and B False.



  19.     ________ template is used to create a single package
     con...
}
}

When the code is executed, it displays the result 0,0. It should
display the result -2.5. Which of the following code...
frmNext frmObj = new frmNext();
frmObj.Show();




   22.     Sam is creating an application. He wants to convert a
      ...
D. Error can be corrected by modifying the given code as:

using System.Text;
......
bype[] ByteData;
Encoding myEncoding;...
A. Set the IsMdiContainer property of frmMainMenu to
     True. Set the ContextMenuStrip property of
     frmMainMenu to c...
{
     SoundPlayer sp = new SoundPlayer();
     sp.LoadAysnc(MusicFile);
     sp.Play();
}



using System.Media;
.......
...
28.     John is creating an MDI application. The application
     contains an MDI parent form named depDetails and an MDI ...
using System;

class Test
{
    public static void calculate(int number1, int
number2)
    {
        try
        {
       ...
using System;

class Test
{
    public static void calculate(int number1, int number2)
    {
        try
        {
       ...
A. PageSetupDialog and PrintPreviewDialog
  B. PrintDialog and PrintDocument
  C. PrintDocument and PrinPreviewDialog
  D....
}
       private void button1_Click(object sender, EventArgs e)
       {
           MessageBox.Show("Button Clicked");
   ...
A. DragOver event is triggered when a user drags an
     item while the moise pointer is within the limits
     of the con...
public void a(string s)
             {
                 lock (this)
                 {
                     Console.WriteL...
the www.yahoo.com page. Which of the following statements can you use
      to perform the above task? (2đ)



   A. Proce...
....
CultureInfo AppCulture = new CultureInfo("en-US");
AppCulture.DateTimeFormat.DateSeparetor = "-";
Thread.CurrentThrea...
A. Change the size of the text
   B. Change the font style of the text
   C. Underline the text
   D. Change the color the...
C. DirectoryInfo MydirInfo = new
     DirectoryInfo(@"C:myDirectory");
FileInfo FilesInDir = MydirInfo.GetFiles();
foreach...
MessageBox.Show("Do You want to continue", "File Save",
MessageBoxIcon.Warning, MessageBoxButtons.YesNoCancel);
}

When Iv...
this.Controls.Add(label1);
label1.Text = "Welcome User";
label1.ForeColor = Color.Red;

   13.         Which of the follow...
{
           Console.WriteLine("Child thread started");
           int SleepTime = 5000;
           Console.WriteLine("Sle...
20.         Which class acts as the base class for all the predefined system
         exceptions? (1đ)

   A. System.Excep...
}
    }

On executing the preceding code snippet, the user enters the value of Number1
as 2 and Number2 as 4. What will be...
class. Which of the following access specifier should John use to
         accomplish this task? (2đ)

   A. Protected
   ...
29.         Which data type can be used for a varuable that stores the grade
         of a student in a particular exam, w...
Test Engine
Upcoming SlideShare
Loading in...5
×

Test Engine

732

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
732
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Test Engine

  1. 1. Test Engine Q3 Soft 1. What is the purpose of public access specifier? (1đ) A. The public access specifier allows a class to hide its member variables and member functions from other class objects and functions. B. The public access specifier allows a class to expose its member variables and member functions to other function and objects. C. The public access specifier allows a class to show its member variables and member functions to the containing class, derived classes, or to classes within the same application. D. The public access specifier allows a class to hide its member variables and member functions from other class objects and functions, except the child class. 2. What is realistic modeling? (1đ) A. Realistic modeling is the approach to model the real world more accurately. B. Realistic modeling is the approach to exist in different forms. C. Realistic modeling is the approach to allow systems to evolve. D. Realistic modeling is the approach of using existing classes or objects from other applications. 3. John has written a program in C# to store a list of random numbers in an array of size 10. During program execution, John tries to enter an 11th element in the array. Identify the type of exception the system would have thrown. (2đ) A. System.IndexOutOfRangeException B. System.DividedByZeroException C. System.NullReferenceException D. System.OutOfMemoryException 4. What is the purpose of the member, Appentd, in the FileMode enumerator? (1đ) A. It always creates a new file.
  2. 2. B. It opens the file if it exists and places the cursor at the end of file, or creates a new file. C. It opens only existing file. D. It opens the file if it exists and places the cursor at the beginning of file. 5. Which of the following does NOT hold true for a delegate? (1đ) A. The methods that can be referenced by a delegate are determined by the delegate declaration. B. A multicast delegate derives from the System.MulticastDelegate class. C. A delegate is a reference type variable, which holds the reference to a method. D. A single-cast delegate contains an invocation list of multiple methods. 6. Consider the following code snippet: (4đ) public class Test { public delegate void myDelegate(String s); public static void accept(string str) { Console.WriteLine("{0} accept() function", str); //Implementation } public static void show() { //Implementation } public static void display(myDelegate PMethod) { PMethod("This is in the"); } public static void Main() { myDelegate d1 = new myDelegate(accept); myDelegate d2 = new myDelegate(show); display(d1); display(d2); } } There is some problem in the preceding code snippet. Identify the problem and provide the correct code snippet.
  3. 3. A. public class Test { public delegate void myDelegate(String s); public static string accept(string str) { Console.WriteLine("{0} accept() function", str); return str; } public static string show(string str) { Console.WriteLine("{0} display() function", str); return str; } public static void display(myDelegate PMethod) { PMethod("This is in the"); } public static void Main() { myDelegate d1 = new myDelegate(accept); myDelegate d2 = new myDelegate(show); display(d1); display(d2); } } B. public class Test { public delegate void myDelegate(); public static void accept(string str) { Console.WriteLine("{0} accept() function", str); //Implementation } public static void show(string str) { Console.WriteLine("{0} display() function", str); //Implementation } public static void display(myDelegate PMethod) { PMethod("This is in the"); } public static void Main() { myDelegate d1 = new myDelegate(accept); myDelegate d2 = new myDelegate(show); display(d1); display(d2); } } C. public class Test {
  4. 4. public delegate void myDelegate(String s); public static void accept(string str) { Console.WriteLine("{0} accept() function", str); //Implementation } public static void show(string str) { Console.WriteLine("{0} display() function", str); //Implementation } public static void display(myDelegate PMethod) { PMethod("This is in the"); } public static void Main() { myDelegate d1 = new myDelegate(accept); myDelegate d2 = new myDelegate(show); display(d1); display(d2); } } D. public class Test { public delegate void myDelegate(String s); public static void accept() { //Implementation } public static void show() { //Implementation } public static void display(myDelegate PMethod) { PMethod("This is in the"); } public static void Main() { myDelegate d1 = new myDelegate(accept); myDelegate d2 = new myDelegate(show);
  5. 5. display(d1); display(d2); } } 7. Which of the following does NOT hold true for constructor? (1đ) A. Instance constructors are used to initialize data members of the class B. Static constructors are used to initialize non- static variables of a class C. Static constructors have an implicit private access. D. Instance constructor is called whenever an instance of a class is created 8. Consider the following code: (4đ) class Test { public Test() { } public Test(string name) { Console.WriteLine("Hello" + name); } } class myClass : Test { public myClass(int age) : base("Sam") { Console.WriteLine("Your age is " + age); } public myClass(string book) { Console.WriteLine("Your favourite book is " + book); } public static void Main() { myClass obj1 = new myClass(17); myClass obj2 = new myClass("The trail of years"); } } Identify the output of the preceding code. Hello Sam Your age is 17
  6. 6. Your favorite book is The trail of years Your age is 17 Your favorite book is The trail of years Hello Sam Your age is 17 Your favorite book is The trail of years Hello Sam 9. John has to create an application in which he needs to create a user-defined exception class CustomerRecordNotFoundException. In the CustomerRecordNotFoundException class, he has to declare two constructors with different parameters. Which of the following code snippet he should use for this purpose? (4đ) using System; public class CustomerRecordNotFoundException : Exception { public CustomerRecordFoundException() { } public CustomerRecordNotFoundException(string message) : base(message) { } } public CustomerRecordNotFoundException : ApplicationException { public CustomerRecordNotFound() { }
  7. 7. public CustomerRecordNotFound(string message) : base(message) { } } public class CustomerRecordNotFoundException : ApplicationException { public CustomerRecordNotFoundException() { } public CustomerRecordNotFoundException(string message) : Exception(message) { } } public class CustomerRecordNotFoundException : ApplicationException { public CustomerRecordNotFoundException() { } public CustomerRecordNotFoundException(string message) : Exception(message) { } } 10. Mary has to write a program in which she wants all the variables of a class to be accessible only within that class and its sub classes. Which of the following access specifier should Mary use to accomplish this task? (2đ) A. Public B. Internal C. Private D. Protected 11. 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 created. However, if the file exists, she needs to ensure that
  8. 8. the pointer is at the beginning of the file. Identify the correct code snippet that would enable Anna to accomplish this task. (3đ) FileStream fs = new FileStream("Test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.End); string struct = sr.ReadLine(); FileStream fs = new FileStream("Test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.Begin); string struct = sr.ReadLine(); FileStream fs = new FileStream("Test.txt", FileMode.Open, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.Begin); string struct = sr.ReadLine(); FileStream fs = new FileStream("Test.txt", FileMode.CreateNew, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.Begin); string struct = sr.ReadLine(); 12. Which of the following is a logical operator? (1đ) A. & B. ++ C. == D. /= 13. John wants to write a program in C# to display a list of first n natural numbers. The total numbers of natural numbers to be displayed needs to be accepted from the user. Identify the correct code that would enable John to accomplish his task. (3đ) A. class Numbers { public int range; public void Accept() { Console.WriteLine("Enter the range: "); range = Convert.ToInt32(Console.ReadLine()); } public void Display() { for (int i = 1; i <= range; i++)
  9. 9. { Console.Write(i + "t"); } } public static void Main(string[] args) { Numbers obj = new Numbers(); Numbers.Accept(); Numbers.Display(); } } B. class Numbers { public int range; public void Accept() { Console.WriteLine("Enter the range: "); range = Convert.ToInt32(Console.ReadLine()); } public void Display() { for (int i = 1; i <= range; i++) { Console.Write(i + "t"); } } public static void Main(string[] args) { Numbers obj = new Numbers(); obj.Accept(); obj.Display(); } } C. class Numbers { public int range; public void Accept() { Console.WriteLine("Enter the range: "); range = Convert.ToInt32(Console.ReadLine()); }
  10. 10. public void Display() { for (int i = 1; i <= range; i++) { Console.Write(i + "t"); } } public static void Main(string[] args) { Accept(); Display(); } } D. class Numbers { public int range; public void Accept() { Console.WriteLine("Enter the range: "); range = Convert.ToInt32(Console.ReadLine()); } public void Display() { for (int i = 1; i <= range; i++) { Console.Write(i + "t"); } } public static void Main(string[] args) { Numbers obj = new Numbers(); Accept(); Display(); } } 14. Consider the following code snippet: (2đ) class Medicine { public static void Main(string[] args) { string lMedicine_Name; double Medicine_Price; Console.WriteLine("Enter the name of the medicine: "); lMedicine_Name = Console.ReadLine(); Console.WriteLine("The price of the medicine is Rs.50"); Console.ReadLine(); } }
  11. 11. When the preceding code is executed, it show error. Identify the error in the preceding code. A. The data type used with the variable Medicine_Price is invalid B. The variable lMedicine_Name is invalid C. The variable Medicine_Price is invalid D. The data type used with the variable lMedicine_Name is invalid 15.Which data type can be used for a variable that stores the grade of a student in a particular exam, where the grades can be A, B, or C? (1đ) A. int B. char[] C. char D. float 16. Which of the section handlers, used by the .NET Framework, return a hash table containing name/value settings ? (1đ) A. SingleTagSectionHandler B. IgnoreSectionHandler C. DictionarySectionHandler D. NameValueSectionHandler 17. You are creating a deployment project. You want to add a registry to the deployment project by using Registry Editor. Which of the following option provides the correct setps to add a registry key to the deployment project ? (3đ)10.20 1.Select View  Editor  Registry to open the Registry Editor. 2.Select one of the top-level key nodes in the Registry Editor. 3.Select Action  New Key to create a New Key node in the selected top-level key node. 4. Specify the name of the key by setting the Name property in the Properties window.
  12. 12. 1.Select View  File System  Registry to open the Registry Editor. 2.Select one of the top-level key nodes in the Registry Editor. 3.Select Action  New Key to create a New Key node in the selected top-level key node. 4.Specify the name of the key by setting the KeyName property in the Properties window. 1.Select View  File System  Registry to open the Registry Editor. 2.Select one of the top-level key nodes in the Registry Editor. 3.Select Action  New  Key to create a New Key node in the selected top- level key node. 4.Specify the name of the key by setting the Name property in the Properties window. 1.Select View  File System  Registry to open the Registry Editor. 2.Select one of the top-level key nodes in the Registry Editor. 3.Select Action  New  Key to create a New Key node in the selected top- level key node. 4.Specify the name of the key by setting the Name property in the Properties window. 18. Consider the following two statements: (2đ) A.Major version number of an assembly gets changed while adding a new class or a new project. B.Minor version number of an assembly gets changed when a module or function is added to the project. Which of the following option is correct with regard to the above mentioned statements ? A. Both A and B are True. B. Both A and B are False.
  13. 13. C. A False and B True. D. A True and B False. 19. ________ template is used to create a single package containing all the files, resources, registry entries, and the setup logic necessary for deploying a component. (1đ) A. Cab Project B. Setup Project C. Merge Module Project D. Web Setup Project 20. Consider the following code which is written to overload a unary operator: (3đ) using System; namespace p { class opr { public int a, b; public opr(int x, int y) { a = x; b = y; } public static opr operator -(opr o) { o.a- = o.a; o.b- = o.b; return o; } public void display() { Console.WriteLine("a=" + a); Console.WriteLine("b=" + b; Console.ReadLine(); } } class opr.override { static void Main() { opr obj = new opr(2, -5); obj = -obj; obj.display(); }
  14. 14. } } When the code is executed, it displays the result 0,0. It should display the result -2.5. Which of the following code will solve this problem? public static opr operator -(opr o) { o.a = -o.a; o.b = -o.b; return o; } public static opr operator --(opr o) { o.a-- = o.a; o.b-- = o.b; return o; } public static opr operator -(opr o) { o.a = -o.a; o.b = -o.b; return a,b; } public static opr operator --(opr o) { o.a = --o.a; o.b = --o.b; return o; } 21. 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? (3đ) frmNext frmObj; fmrObj.Show() frmNext.Show(); show(frmNext);
  15. 15. frmNext frmObj = new frmNext(); frmObj.Show(); 22. Sam is creating an application. He wants to convert a source data from the character array, named charData, to a byte array by using code Page 1253 format. He writes the following code to perform this activity. (4đ) using System.Text; ...... bype[] ByteData; Encoding myEncoding; myEncoding = Encoding.GetEncoding(1253); ByteData = myEncoding.GetBytesArray(charData); On building the application, he receives an compile time error in the above mentioned code. How this error can be corrected? A. Error can be corrected by modifying the given code as: using System.Text; ...... bype[] ByteData; Encoding myEncoding; myEncoding = Encoding.Convert(1253); ByteData = myEncoding.GetBytesArray(charData); B. Error can be corrected by modifying the given code as: using System.Text; ...... bype[] ByteData; Encoding myEncoding; myEncoding = new Encoding(1253); ByteData = myEncoding.GetBytesArray(charData); C. Error can be corrected by modifying the given code as: using System.Text; ...... bype[] ByteData; Encoding myEncoding; myEncoding = Encoding.GetEncoding(1253); ByteData = myEncoding.GetBytes(charData);
  16. 16. D. Error can be corrected by modifying the given code as: using System.Text; ...... bype[] ByteData; Encoding myEncoding; myEncoding = new Encoding(1253); ByteData = myEncoding.GetBytes(charData); 23. Consider the following statements: (2đ) A: Output file of a custom control is created in the <Application Folder>Debugbin folder B: Output file of a custim control will be a DLL file. Which of the following option is true with regard to above mentioned statements? A. Both A and B True. B. Both A and B False. C. A True and B False. D. A False and B True. 24. Which assembly is responsible for exposing the ActiveX control as a .NET control? (1đ) A. Axinterop.msacal B. MASCAL C. Axinterop.MSACAL D. Axinterop.Mascal 25. You created a form named frmMainMenu. You also added a ContexMenuStrip control named cmMenu1 to frmMainMenu. When a user right-clicks frmMainMenu, the context menu must be displayed. When a user selects the View option from the context menu, another form named frmView must be displayed as the child form of frmMainMenu. Which of the following options will help you achieve this? (4đ)
  17. 17. A. Set the IsMdiContainer property of frmMainMenu to True. Set the ContextMenuStrip 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; frmObj.Show(); B. Set the IsMdiContainer property of frmMainMenu to True. Set the ContextMenuStrip 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; C. Set the IsMdiContainer property of frmView to True. Set the ContextMenuStrip 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(); D. Set the IsMdiContainer property of frmMainMenu to True. Set the ContextMenuStrip 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(); 26. Sam is developing an application. He wants to write code to play a wave file on the Click event of a Button control, named btnPlay. The name of the wave file to be played is already stored in a string variable, named MusicFile. Due to large size of the wave file, he wants that the file should be loaded asynchronously in the background. Which of the following options gives the correct code to perform this activity? (3đ) using System.Media; ....... private void btnPlay_Click(object sender, EventArgs e)
  18. 18. { SoundPlayer sp = new SoundPlayer(); sp.LoadAysnc(MusicFile); sp.Play(); } using System.Media; ....... private void btnPlay_Click(object sender, EventArgs e) { SoundPlayer sp = new SoundPlayer(MusicFile); sp.Play(); } using System.Media; ....... private void btnPlay_Click(object sender, EventArgs e) { SoundPlayer sp = SoundPlayer.LaodAsync(MusicFile); sp.Play(); } using System.Media; ....... private void btnPlay_Click(object sender, EventArgs e) { SoundPlayer sp = new SoundPlayer(); sp.LoadAysnc(MusicFile); sp.PlayAsync(); } 27. Which of the following method of the Process control will stop the execution of a process for specified number of seconds? (1đ) A. Sleep() B. SleepForExit() C. WaitForExit() D. Wait()
  19. 19. 28. John is creating an MDI application. The application contains an MDI parent form named depDetails and an MDI child form frmSales. Now he wants that when a user click the menuSales menu iten on the deptDetails form than the frmSales form should be displayed. Which of the following code option will perform the desired operation? (3đ) private void menuSales_Click(object sender, EventArgs e) { frmSales objSales = new frmSales(); objSales.MdiParent = this; objSales.Show(); } private void menuSales_Click(object sender, EventArgs e) { frmSales objSales = new frmSales(); objSales.MdiParent = this; frmSales.Show(); } private void menuSales_Click(object sender, EventArgs e) { Form objSales = new Form(frmSales); objSales.MdiParent = this; objSales.Show(); } private void menuSales_Click(object sender, EventArgs e) { frmSales objSales = new frmSales(); objSales.MdiParent = deptDetails; objSales.Show(); } 29. Mary needs to write a program to divide two numbers. She needs to ensure that the program does not terminate abruptly in the event of any exception. Write a code that would enable Mary to accomplish her task. (3đ)
  20. 20. using System; class Test { public static void calculate(int number1, int number2) { try { int res = number1 / number2; Console.WriteLine(res); } catch(DivideByZeroException e) { Console.WriteLine(e.ToString()); } } public static void Main() { Test.calculate(8, 0); Console.ReadLine(); } } using System; class Test { public static void calculate(int number1, int number2) { try { int res = number1 / number2; Console.WriteLine(res); } Throw DivideByZeroException e){} } public static void Main() { Test.calculate(8, 0); Console.ReadLine(); } }
  21. 21. using System; class Test { public static void calculate(int number1, int number2) { try { int res = number1 / number2; Console.WriteLine(res); catch(DivideByZeroException e) Console.WriteLine(e.ToString()); } } public static void Main() { Test.calculate(8, 0); Console.ReadLine(); } } using System; class Test { public static void calculate(int number1, int number2) { try { int res = number1 / number2; Console.WriteLine(res); } catch(IndexOutOfRangeException e) { Console.WriteLine(e.ToString()); } } public static void Main() { Test.calculate(8, 0); Console.ReadLine(); } } 30. Which of the following controls you need to add to the form to invoke the default Print dialog box? (1đ)
  22. 22. A. PageSetupDialog and PrintPreviewDialog B. PrintDialog and PrintDocument C. PrintDocument and PrinPreviewDialog D. PrintDialog and PrintPreviewDialog 31. Which of the following option will convert an integer variable, named MuCurrency, to the culture specific currency formating? (2đ) A. MyCurrency.ToString("C", Thread.CurrentThead.CurrentCulture); B. Thead.CurrentThread.CurrentUlCulture.MyCurrency.ToString("C"); C. Thread.CurrentThread.CurrentCulture.MyCurrency.ToString("C"); D. MyCurrency.ToString("C", Thread.CurrentThread.CurrentUlCulture); 32. Which of the following value of SelectionMode property of ListBox control allows the user to select multiple items and use the Shift, Ctrl, and arrow keys to make selections from the ListBox control? (2đ) A. MultipleExtended B. MultiSimple C. MultiExtended D. MultiSelection 33. Ivan is creating a Windows form named form1 for an application. He wants 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. (4đ) private void Form1_Load(object sender, EventArgs e) { button1.Text = "Click me"; this.Controls.Add(button1); } public Form1() { InitializeComponent();
  23. 23. } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Button Clicked"); } When Ivan runs the applications and clicks the button1, no message box is displayed. How this error can be corrected? A. Use Form.Controls.Add(button1); code line in place of this.Controls.Add(button1); code line in the Form1_Load event. B. Add the following code beneath the InitializeComponent() line of button1.Click += new EventHandler(button1_Click); C. Use Message.Show() method in place of MessageBox.Show() method in the button1_Click() event. D. Create the instance of the Button control inside the Form1_Load method in place of outside the Form1_Load method. 34. Sam is creating a Windows form for a GUI application. In addition to other controls, he adds an ErrorProvider control named errorProvider1 to the form and use the SetError method to display error messages for various controls. In case of any error. Now he wants that error icon of the errorProvider1 should not blink while notifying the error for any control. Which of the following code snippet will change the blinking property of the error icon accordingly? (3đ) A. errorProvider1.BlinkStyle = ErrorBlinkStyle.DoNotBlink; B. errorProvider1.BlinkStyle = ErrorBlinkStyle.NeverBlink; C. errorProvider1.BlinkRate = ErrorBlinkStyle.NeverBlink; D. errorProvider1.BlinkRate = ErrorBlinkStyle.DoNotBlink; 35. Which of the following statements correctly describes the DragOver event of the drag-and-drop operation? (2đ)
  24. 24. A. DragOver event is triggered when a user drags an item while the moise pointer is within the limits of the control’s boundaries. B. DragOver event is triggered on the completion of the drag-and-drop operation. C. DragOver event is triggered when a user drags an item onto the control’s boundaries. D. DragOver event is triggered when a user drags an item out of the control’s boundaries. 36. A cross-platform, hardware and software independent markup language that enables you to store data in a structured form at by using meaningful tags that can be interpreted by any computer system is ________ (1đ) A. JavaScript B. XML C. HTML D. DHTML 37. John has developed a function, tmpConvert(), in C# to convert temperature from Fahreheit to Celsius. He asked to modify this function so as to display the result to the user. Therefore, John creates a new function, tmpConvert_New(). However, he wants to retain the previous function, tmpConvert(), which he had created earlier. Which attribute should John user accomplish this task? (2đ) A. Dllimport B. Conditional C. WebMethod D. Obsolete 38. Consider the following code snippet: (4đ) class abc {
  25. 25. public void a(string s) { lock (this) { Console.WriteLine("start"); for (int i = 0; i < 50; i++) { Console.Write(s); } Console.WriteLine("end"); } } } What does the lock statements refer to? A. It refers to Synchronization. B. It will generate an error. C. It refers to Lock starvation. D. It refers to monitor locks. 39. Which predefined attribute enables you to inform the compiler to discard a piece of target element? (1đ) A. WebMethod B. Obsolete C. Dllimport D. Conditional 40. Which of the following options is not the valid value for Right To Left property of the form? (2đ) A. Yes B. No C. True D. Inherit 1. You created a form containing a LinkLabel control, llConnect. When a user clicks the LinkLabel control, a browser window should open with
  26. 26. the www.yahoo.com page. Which of the following statements can you use to perform the above task? (2đ) A. Process.Diagnostics.Start(“http://www.yahoo.com”) B. System.Diagnostics.Start(“http://www.yahoo.com”) C. System.Start(“http://www.yahoo.com”) D. System.Diagnostics.Process.Start(“http://www.yahoo. com”) 2. Sam is creating an application. He wants that formatting of elements in the application should be done according to the “en-US” culture, but the data separator, string used to separate the date information, should be used as “-“ in spite of date separator used by “en-US” (4đ) using System.Globalization; using System.Threading; .... CultureInfo AppCulture = new CultureInfo("en-US"); AppCulture.DateTimeFormat.DateSeparetor = "-"; 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; .... CultureInfo AppCulture = new CultureInfo("en-US"); AppCulture.DateTimeFormat.DateSeparetor = "-"; Thread.CurrentThread.CurrentCulture = AppCulture; B. The error can be corrected by modifying the given code as: using System.Globalization; using System.Threading; .... CultureInfo AppCulture = CultureInfo.GetCulture("en-US"); AppCulture.DateTimeFormat.DateSeparetor = "-"; CurrentThread.CurrentCulture = AppCulture; C. The error can be corrected by modifying the given code as: using System.Globalization; using System.Threading;
  27. 27. .... CultureInfo AppCulture = new CultureInfo("en-US"); AppCulture.DateTimeFormat.DateSeparetor = "-"; Thread.CurrentThread.Culture = AppCulture; D. The error can be corrected by modifying the given code as: using System.Globalization; using System.Threading; .... CultureInfo AppCulture = new CultureInfo("en-US"); AppCulture.DateFormat.DateSeparetor = "-"; CurrentThread.CurrentCulture = AppCulture; 3. Which of the following statement correctly describes the CurrentCulture property of the CultureInfo class? (2đ) A. CurrentCultere property returns an instance of the CultureInfo class that represents the culture for culture-specific resources. B. CurrentCulture property returns the name of the culture in the <Language code>-<Country/Region code> format. C. CurrentCulture property returns the full name of the culture in the <Language code>-<Country/Region code> format. D. CurrentCulture property returns an instance of the CultureInfo class that represents the culture for the current thread. 4. Which property of the ToolTip con trol is used to set the time period for which the moise pointer remains stationary in the tooltip region before the tooltip appears? (1đ) A. AutopopDelay B. ReshowDelay C. AutomaticDelay D. InitialDelay 5. You added a ContextMenuStrip control named cmContext1 to a form. The control has two options, Product Master and Salas Data Entry. How will you ensure that the menu items of cmContext1 are displayed when a user right-clicks the form? (4đ) A. By setting the ContextMenuStrip property of the form to True B. By setting the ControlBox property of the form to cmContext1 C. By setting the ContextMenuStrip property of the form to cmContext1 D. By setting the IsMdiContainer property of the ContextMenuStrip control to the name of the form 6. Which of the following action cannot be performed on a text by using a dialog box created by the FontDialog class? (1đ)
  28. 28. A. Change the size of the text B. Change the font style of the text C. Underline the text D. Change the color the text 7. You are creating MDI application. You want to add a menu to the MDI parent form that holds the ame of all the opened child windows and also allows a user to switch between the opened MDI child windows. Which of the following option gives the correct steps to perform this activity? (3đ) A. 1.Create a menu named Window 2.Select the Window menu from the properties window and the property named MDIList to True B. 1.Create a menu named Window 2.Select the Window menu from the properties window and the property named ActiveMDIChild to True C. 1.Create a menu named Window 2.Select the Window menu from the properties window and the property named MDILayout to TileVertical D. 1.Create a menu named Window 2.Select the Window menu from the properties window and set the property named WindowList to True 8. Sam is asigned a task to write a program that displas a list of all the files present in a particular directory. He needs to display 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. (3đ) 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 MydirInfo) { Console.WriteLine("File Name: {0} Size: {1} bytes Extension: {2} ", MydirInfo.Name, MydirInfo.Length, MydirInfo.Extension); } Console.ReadLine();
  29. 29. C. DirectoryInfo MydirInfo = new DirectoryInfo(@"C:myDirectory"); FileInfo FilesInDir = MydirInfo.GetFiles(); foreach (FileInfo file in FileInDir) { 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 = FilesInDir.GetFiles(); foreach (FileInfo file in FileInDir) { Console.WriteLine("File Name: {0} Size: {1} bytes Extension: {2} ", file.Name, file.Length, file.Extension); } Console.ReadLine(); 9. Which of the following property of a Windows form is set to true to create an MDI Parent form? (1đ) A. ActiveMdiChild B. MdiLayout C. IsMDIContainer D. MdiParent 10. Which type of project is created by selecting the Class Library template in Microsoft Visual Studio? (2đ) A. Class Library template creates an application with a Windows user interface. B. Class Library template creates a console application that can run from the command prompt. C. Class Library template creates a class or a reusable component (.dell or .exe) that exposes some functionality to be used in various projects. D. Class Library template creates a custom control that can be added to the user interface. 11. 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, Cancel button. He writes the following code to display the message box. (4đ) private void button1_Click(object sender, EventArgs e) {
  30. 30. MessageBox.Show("Do You want to continue", "File Save", MessageBoxIcon.Warning, MessageBoxButtons.YesNoCancel); } When Ivan run this code, compile time error has occurred. How this error can be corrected. Ivan should modìy the given code as: private void button1_Click(object sender, EventArgs e) { MessageBox.ShowMessage("Do You want to continue", "File Save", MessageBoxButtons.YesNoCancel, , MessageBoxIcon.Warning); } Ivan should modify the given code as: private void button1_Click(object sender, EventArgs e) { MessageBox.ShowMessage("Do You want to continue", "File Save", MessageBoxIcon.Warning, MessageBoxButtons.YesNoCancel); } _____________________________________________________________________________ ________________________ 12. John is creating a Windows form named form1 for a .NET application. He wants to add a Label control named label1 in form1 at run time and wants to set the text property of the label1 equals to “Welcome User”. John also wants that label1 should be displayed in red color. Which of the following option will correctly perform this task? (3đ) A. Add the following code in the form1_Load event Label label1 = new Label(); Form1.Controls.Add(label1); label1.Text = "Welcome User"; label1.ForeColor = Color.Red; B. Add the following code in the form1_Load event Label label1 = new Label(); this.AddControls(label1); label1.Text = "Welcome User"; label1.TextColor = Color.Red; C. Add the following code in the form1_Load event Label label1 = new Label(); this.Controls.Add(label1); label1.Text = "Welcome User"; label1.TextColor = Color.Red; D. Add the following code in the form1_Load event Label label1 = new Label();
  31. 31. this.Controls.Add(label1); label1.Text = "Welcome User"; label1.ForeColor = Color.Red; 13. Which of the following statements correctly describes the system modal dialog box? (2đ) A. A system modal dialog box does not allow a user to switch focus to another area of the application, which has invoked the dialog box. However, user can switch to other windows application. B. 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. C. 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. D. 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. 14. Which of the following are the features of the Windows environment? (1đ)1.10 A.Dynamic linking B.Event-driven C.Command Line Interface (CLI) A. C and B B. A and C C. A and B D. A,B and C 15. Consider a scenario in which there are currently two threads, T1 and T2, running on a single processor system. Now T2 has to perform some I/O related task. Therefore, T2 blocks T1 for some time. Which state is thread T1 currently in? (2đ) A. Not Runnable B. Runnable C. Unstarted D. Dead 16. Consider the following class definition: (4đ) using System; using System.Threading; class sleep_demo { public static void ChildThreadCall()
  32. 32. { Console.WriteLine("Child thread started"); int SleepTime = 5000; Console.WriteLine("Sleeping for {0} seconds", SleepTime /1000); Thread.Sleep(SleepTime); Console.WriteLine("Wakeing Up"); } } Choose the correct definition for Main() to execute it. public static void Main() { ThreadState ChildRef = new ThreadState(ChildThreadCall); Console.WriteLine("Main - Creating Child thread"); ChildThread.Start(); Console.WriteLine("Main - Have requested the start of child thread"); Console.ReadLine(); } _____________________________________________________________ 17. Which predifined attribute enables you to inform the compiler to discard a piece of target element? (1đ) A. Obsolete B. WebMethod C. Dllimport D. Conditional 18. Consider the following statements: (2đ) Statement A: Crystal Reports support two models, pull and push, to access data from a data source. Statement B: In the push model, the database driver directly retrieves the data from the data source. Which of the following is true, with respect to the above statements? A. Both A and B are True B. Both A and B are False C. A is True and B is False D. A is False and B is True 19. Which of the following holds true for encapsulation? (2đ) A. Encapsulation is defined as the process of looking for what you want in an object or a class. B. Encapsulation is defined as the process of allowing access to nonessential details. 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 viewing the relevant information to the user.
  33. 33. 20. Which class acts as the base class for all the predefined system exceptions? (1đ) A. System.Exception B. System.AppDomainUnloadedException C. System.SystemException D. System.ApplicationException 21. Which of the following is the correct syntax for declaring a delegate? (1đ) A. delegate <return type> <delegate-name> <parameter list> B. <return type> <delegate-name> <parameter list> C. <return type> delegate <delegate-name> <parameter list> D. Delegate <delegate-name> <return type> <parameter list> 22. Which is an instance constructor? (1đ) A. An instance constructor is a class that is called whenever an instance of that class is created. B. An instance constructor is a method that is called whenever and instance of a class is created. C. An instance constructor is an event that called whenever an instance of a class is created. D. An instance constructor is a static method that is called whenever an instance of a class is created. 23. Mary has written a program in which she needs to accept the values of two integer variables, number1 and number2, from the user. After accepting two integer values from the user, she needs to perform some modification on these integer values as shown in the following code snippet: (4đ) public class Test { void modify(ref int a, int b) { int temp; temp = a; a = b; b = temp; } static void Main(string[] args) { Test classobj = new Test(); classobj.modify(ref Number1, Number2); //The value of Number1 and Number2 has already been accepted from the user Console.ReadLine();
  34. 34. } } On executing the preceding code snippet, the user enters the value of Number1 as 2 and Number2 as 4. What will be the final values stored in Number1 and Number 2 once the execution of the preceding code snippet finishes? A. Value of Number1 = 2 Value of Number2 = 2 B. Value of Number1 = 4 Value of Number2 = 2 C. Value of Number1 = 2 Value of Number2 = 4 D. Value of Number1 = 4 Value of Number2 = 4 24. Predict the output of the following: (4đ) using System; using System.IO; class classmain { public static void Main() { int i = 0; cnt = 1; char ch; FileStream fs = new FileStream("C:Myfile.txt", FileMode.OpenOrCreate, FileAccess.Read); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.Begin); while ((i = sr.Read()) != -1) { ch = Convert.ToChar(i); if (ch == ' ' || ch == 'n' || ch == 't') cnt++; } Console.Write(cnt); Console.Read(); } } A. It will count the number of pages in a file. B. It will count the number of words in a file. C. It will count the number of characters in a file. D. It will count the number of lines in a file. 25. John has to write a program in which he wants to all the variables of a class to be accessible only within the functions of that
  35. 35. class. Which of the following access specifier should John use to accomplish this task? (2đ) A. Protected B. Internal C. Public D. Private 26. How may bytes are requited to store a variable of type char? (1đ) A. 4 B. 3 C. 2 D. 1 27. Henry wants to develop a code to calculate the sum of two numbers. These numbers should be accepted from the user. Identify the correct code that would enable Henry to accomplish his task (3đ) class Test { public void Calculate() { Console.WriteLine("Enter first number: "); int num1 = Console.ReadLine(); Console.WriteLine("Enter second number: "); int num2 = Console.ReadLine(); int result = (num1 + num2); Console.WriteLine(result); } public static void Main(string[] args) { Test obj = new Test(); obj.Calculate(); } } ____________________________________________ 28. 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 gives the following messages, if the customer rating is in: (2đ) Range 1-4: The customer is overall dissatisfied with your support. Range 5-7: The customer is some what satisfied with your work. Range 8-9: The customer is very satisfied and happy with your work. Identify the programming construct implemented in the preceding software. A. do while loop construct B. while loop construct C. switch case construct D. nested if else construct
  36. 36. 29. Which data type can be used for a varuable that stores the grade of a student in a particular exam, where the grades can be A, B or C? (1đ) A. Float B. Char[] C. Char D. Int 30. Which of the following option of the gacutil command is used to register the assembly to the GAC? (1đ) 10.6 .net 2 đáp án /I A. /l B. /u C. /f D. /r 31. You are configuring an application by using the application configuration file. In this process you want to enable the concurrent garbage collection by the CLR. Which of the following code snippet will correctly specify the required settings? (3đ) A. <configuration> <runtime> <gcConcurrent enabed=”true”/> </runtime> </configuration> B. <configuration> <startup> <gcConcurrent enabed=”true”/> </startup> </configuration> 32. You need to create a database during installation. Which editor would you use? (2đ) A. Custom Actions Editor B. Launch Conditions Editor C. File Types Editor D. User Interface Editor

×