You are on page 1of 17

Unit I MCQ

Q.1 ___________ namespace is not defined in the .NET class library. a. System b. System.CodeDom c. System.IO d. System.Thread Q.2 Which object oriented concept is related to the derivation of a class based on another class? a. Encapsulation b. Polymorphism c. Data Hiding d. Inheritance Q.3 Which of the following is not C# value types? a. long b. bool c. struct d. class
Q.4 A local variable

a) Can be used anywhere in the program b) Is declared within a method c) Must accept a class d) Represent a class object Q.5 An instance method a) Represents the behavior of an object b) Represents the attribute of an object c) Represents another class d) a and b Q.6 A Constructor a) is used to create objects b) must have the same name as the class it is declared within c) maybe overloaded d) all of the above Q.7 A variable declared inside a method is called a________variable a) Static b) Private c) Local d) b and d Q.8 Defining two methods with the same name but with different parameters is called. a) Overriding b) Overloading c) Multiplexing d) Duplexing Q.9 In the body of a method, C# uses the variable named_____to refer to the current object
whose method is being invoked.

a) call

b) this c) do d) that
Q.10 Is it possible to pass methods as arguments for other methods without modification.

a) True b) False Q.11 What is the proper header for a class that intends to use an interface. a) class MyClass IFace b) class MyClass ; IFace c) class MyClass : IFace d) class MyCalss {IFace}

Q.12 Every class directly or indirectly extends the______class.


a) System b) Object c) Drawing d) Console Q.13 Polymorphism occurs when the methods of the child class. a) Override the parent class methods but maintain the implementation b) Maintain the same return type and arguments as the parent class, but implement it differently c) Have different return types and arguments than the parent class d) Are Virtual Q.14 To output the value of multidimensional array, Console.WriteLines(___) a) myArray[1][3]; b) myArray[1.3]; c) myArray{1}{3}; d) myArray(1),(3); Q.15 All methods in an abstract base class must be declared abstract. a) True b) False Q.16 Methods that are declared abstract in the base class must show implementation at the time of
declaration.

a) . True b) False Q.17 The code public class B : A { } a) Defines a class that inherits all the methods of A b) Defines a class that inherits the public and protected methods of A only c) Errors d) a and b Q.18 Classes declared with the sealed keyword cannot be base class. a) True b) False Q.19 A method_____an exception when that method detects that a problem has occured. a) Trys b) . Catches c) Throws d) a and b

Q.20 Exception objects are derived from the class. a) Try b) System c) Exception d) Event Q.21 A String literal is a: a) only contains one character b) contains numbers rather than letters c) sequence of characters in double quotation marks d) contains exactly its variable name and nothing else Q.22 To create a string literal exclude escape sequence, use: a) !string b) @string c) #string d) $string Q.23 The proper way to convert a string to all lowercase is: a) String = string.ToLower(string); b) ToLower(string); c) string.ToLower(); d) string.ToLower(string);

Q.24 Which of the following has the lowest precedence?


a. b. c. d. Bitwise operators Multiplication and Division Assignment operators Logical operators

Q.25 Which access specifier will you use to make base class members accessible in the derived class and not accessible for the rest of the program? a. public access specifier b. private access specifier c. protected access specifier d. static access specifier Q.26 Which of the following define the rules for .Net Languages? a. CLS b. CLI c. CTS d. CLR Q.27 Which of the following is true? a. Function overloading is an example of static polymorphism b. Function overloading is an example of dynamic polymorphism c. Operator overloading is an example of dynamic polymorphism d. None of these

Q.28 Which of the following is true about operator overloading? a. *operator can be overloaded to perform division b. **can be overloaded to perform ''to the power of'' c. If == (equality operator) is overloaded then C# rules enforce that!= (inequality operator ) also be overloaded d. If the + operator is overloaded then += works automatically Q.29 Can you overload a function with the same number and types of arguments (parameters) but with a different return type? a. Yes b. No c. Yes, but only if function is static d. Yes, but only if function is virtual Q.30 How can we sort the elements of the array in descending order? a. By calling Sort() method b. By calling Sortdescending() method c. By calling Sortreverse() method d. By calling Sort() and then Reverse() method

Unit 2 Q.1 Which is the file extension used for an ASP.NET file? a.) asn b.) asp c.) aspn d.) aspx Q.2 When an ASP.NET file is placed on an IIS server and viewed through a browser, the resulting HTML page contains: a.) all ASP.NET code. b.) as much ASP.NET code as is in the ASP.NET file. c.) a mix of ASP.NET and HTML code. d.) all HTML code. Q.3 Which of the following statements is incorrect about delegate? a. Delegates are reference types b. Delegates are object oriented c. Only one method can be called using a delegate. d. Delegates serve the same purpose as function pointers in C and pointers to member function operators in C++.

Q.4 Which of the following is the necessary condition for implementing delegates?
a. Class declaration b. Inheritance c. Run-time Polymorphism d. Compile-time Polymorphism

Q.5 Which of the following statements are correct about delegates?


a. Delegates cannot be used to call a static method of a class

b. Delegates cannot be used to call procedures that receive variable number of arguments. c. If signatures of two methods are same they can be called through the same delegate object. d. Delegates cannot be used to call an instance function. Delegates cannot be used to call an instance subroutine.

Q.6 In which of the following collections is the Input/Output index-based?

1. 2. 3. 4. 5. a. b. c. d.

Stack Queue BitArray ArrayList Hashtable 1 and 2 only 3 and 4 only 5 only 1,2 and 5 only

Q.7 In a HashTable Key cannot be null, but Value can be. a. True b. False

Q.8 Which of the following statements are correct about the C#.NET code snippet given below?
Stack st = new Stack(); st.Push("hello"); st.Push(8.2); st.Push(5); st.Push('b'); st.Push(true); a. Dissimilar elements like "hello", 8.2, 5 cannot be stored in the same Stack collection. b. Boolean values can never be stored in Stack collection. c. In the fourth call to Push(), we should write "b" in place of 'b'. d. This is a perfectly workable code.

Q.9 Which of the following is NOT an interface declared in System.Collections namespace?


a. b. c. d. IComparer IEnumerable IDictionaryComparer IDictionaryEnumerator

Q.10 Suppose value of the Capacity property of ArrayList Collection is set to 4. What will be the capacity of the Collection on adding fifth element to it?
a. 4 b. 8 c. 16 d. 32

Q.11 Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?
a. arr.Count b. arr.MaxIndex c. arr.Capacity d. arr.UpperBound

Q.12 Which of the following statements are correct about the Collection Classes available in Framework Class Library?
a. Elements of a collection cannot be transmitted over a network. b. Elements stored in a collection can be retrieved but cannot be modified. c. Elements stored in a collection can be modified only if allelements are of similar types. d. They use efficient algorithms to manage the collection, thereby improving the performance of the program.

Q.13 Which of the following statements is correct about Managed Code?

a. Managed code is the code that is compiled by the JIT compilers. b.Managed code is the code where resources are Garbage Collected. c. Managed code is the code that runs on top of Windows. d.Managed code is the code that is written to target the services of the CLR.

Q.14 Which of the following components of the .NET framework provide an extensible set of

classes that can be used by any .NET compliant programming language? a. .NET class libraries b.Common Language Runtime c. Common Language Infrastructure d.Component Object Model

Q.15 Which of the following jobs are NOT performed by Garbage Collector?

1. 2. 3. 4. 5.

Freeing memory on the stack. Avoiding memory leaks. Freeing memory occupied by unreferenced objects. Closing unclosed database collections. Closing unclosed files.

a. 1, 2, 3 b.3, 5 c. 1, 4, 5 d.3, 4

Q.16 Which of the following statements correctly define .NET Framework?

a.

It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.

It is an environment for developing, building, deploying and executing only Web b. Applications. c. It is an environment for developing, building, deploying and executing Distributed Applications.

d.It is an environment for developing, building, deploying and executing Web Services.

Q.17 Which of the following assemblies can be stored in Global Assembly Cache?

a. Private Assemblies

b.Friend Assemblies c. Shared Assemblies d.Public Assemblies

Q.18 Which of the following is the root of the .NET type hierarchy? a. System.Object b.System.Type c. System.Base d.System.Parent

Q.19 IIS stands for


A) Internet information server B) integrated information server C) Internet information services D) None Q.20 When you create an ASP.NET page, you are actually creating the source code for a .NET class. You are creating a new instance of the _____________class. A) System.Web.UI.Page B) System.Web C) System.Web.Securiy D) System.Configuration Q.21 What is the last stage of the Web forms lifecycle? A) Event Handling B) Page_Load C) Validate D) Page_Unload Q.22 What is the name of the property of ASP.NET page that you can query to determine that a ASP.NET page is being requested not data being submitted to web server? A. FirstGet B. Initialized

C. IncludesData D. IsPostBack Q.23 In Which Page Cycle All Controls Are Fully Loaded? A) Page_Load() B) Page_Init() C) Page_Render() D) Page_Unload() Q.24 What does CSS stand for?

a. b. c. d.

Computer Style Sheets Cascading Style Sheets Colorful Style Sheets Creative Style Sheets

Q.25 What is the correct HTML for referring to an external style sheet?

a. <link rel="stylesheet" type="text/css" href="mystyle.css"> b. <stylesheet>mystyle.css</stylesheet> c. <style src="mystyle.css">


Q.26 What are the three methods of implementing CSS? a. Direct, Indirect, and External

b. Internal, External, and Embedded c. Inline, Embedded, and External

Q.27 How do you make a list that lists its items with squares?

a. list-style-type: square; b. list-type: square; c. list: square;


Q.28 When using the padding property; are you allowed to use negative values? a. No b. Yes

Q.29 Which property is used to change the font of an element? a. font-family

b. font c. Both font-family and font can be used

Q.30 How do you insert a comment in a CSS file? a. // this is a comment b. /* this is a comment */ c. // this is a comment // d. ' this is a comment

Unit 3

Q.1 If c is a variable initialised to 1, how many times will the following loop be executed? while ((c > 0) && (c < 60)) { loop body c ++; } a. b. c. d. 60 59 61 None of these

Q.2 A "switch" statement is used to a. Switch between functions in a program b. Switch from one variable to another variable c. To choose from multiple possibilities which may arise due to different values of a single variable. d. All of above

Q 3. The ________ event is raised when the application is started by IIS a) b) c) d) Application_End Application_Error Application_Start Application_LogRequest

Q 4. The ______ event is raised when the application stops or shuts down a) b) c) d) Application_Start Application_End Application_Error Application_LogReequest

Q 5. The _________ event is raised when an unhandled error occurs and rises up the application scope a) b) c) d) Application_Start Application_End Application_Error Application_LogReequest

Q.6 Which of the following statements is correct about a namespace in C#.NET?

a. Namespaces help us to control the visibility of the elements present in it.


b. A namespace can contain a class but not another namespace. c. If not mentioned, then the name 'root' gets assigned to the namespace. d. It is necessary to use the using statement to be able to use an element of a namespace.

Q.7 Why is Global.asax is used? a. Implement application and session level events b. Declare Global variables c. No use d.Both a and b Q 8. The ___________ controls are Hypertext Markup Language elements that include a runat=server attribute a) b) c) d) HTML Server Controls Web Controls Validation Controls List Controls

Q 9. HTML server controls are derived from ______________ class a) b) c) d) System.Web.UI.HtmlControls.HtmlControl System.Web.UI.WebControls.WebControl System.Validation.Control System.Web.UI.HtmlControl

Q 10. The __________ controls have a standardized set of property names a) b) c) d) Html Server Controls Web Controls List Controls Validation Controls

Q 11. Web controls are derived from ______________ class a) b) c) d) System.Web.UI.HtmlControls.HtmlControl System.Web.UI.WebControls.WebControl System.Validation.Control System.Web.UI.HtmlControl

Q 12. Which of the following languages can be used to write server side scripting in ASP.NET?
a. b. c. d.

C-sharp VB C++ a and b

Q 13. _____________ controls are special Web server controls that are used to display rows of data in a customized template format a) b) c) d) HTML Server Controls Web Controls Validation Controls List Controls

Q 14. ASP.NET provides a few task specific controls called as ___________ controls a) b) c) d) Web Controls Rich Controls Validation Controls List Controls

Q 15. When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.
a. b. c. d.

HTML XML WML JSP

Q 16. The Asp.net server control, which provides an alternative way of displaying text on web page, is
a. b. c. d.

< asp:label > < asp:listitem > < asp:button > < asp:textbox >

Q.17 Which of the following is an 8-byte integer a. char b. short c. long d. integer

Q.18 What is the size of the decimal data type a. 4 byte b. 8 byte c. 16 byte d. 32 byte Q.19 What will be the output of the following code snippet when it is executed? int x=1; float y=1.1f; short z=1; Console.WriteLine((float)x+y*z-(x+=(short)y)); a. 0.1 b. 1.0 c. 1.1 d. 11 Q 20. ________ controls are used to provide descriptive text for a control a) b) c) d) Label LinkLabel TextBox ToolTip

Q 21. A ____________ control can display a hyperlink a) b) c) d) Label LinkLabel TextBox ToolTip

Q 22. The ____________ control does not participate in user input or capture mouse or keyboard events a) b) c) d) Label LinkLabel TextBox ToolTip

Q 23. The ____________ property of the TextBox control is used to mask characters entered in single version of the control a) b) c) d) PasswordChar Length MultiLine ScrollBars

Q 24. The ___________ control provides text editing and advanced formatting features a) TextBox b) RichTextBox c) Button

d) Label Q 25. The ___________ control is used to present data for which the user is allowed some control over the detail and style of its presentation a) b) c) d) TextBox LinkLabel ListView ListBox

Q 26. The ___________ control is a container that allows the display of multiple dialogs on a single form by switching between the tabs a) b) c) d) CheckBox TabControl ListView TextBox

Q 27. __________ is one of the easiest way to access program functions a) b) c) d) TextBox CheckBox RadioButton ToolBars

Q 28. __________ are small messages which are displayed when a mouse pointer moves over a control a) b) c) d) ToolTip Message MessageBox Dialog Box Message

Q.29 Which of the following is the correct output for the C#.NET program given below?
int i = 20 ; for( ; ; ) { Console.Write(i + " "); if (i >= -10) i -= 4; else break; }

a. b. c. d.

20 16 12 84 0 -4 -8 20 16 12 8 4 0 20 16 12 8 4 0 -4 -8 -12 16 12 8 4 0

Q.30 Which of the following statements are correct?


1 Instance members of a class can be accessed only through an object of that class 2. A class can contain only instance data and instance member function.

3. All objects created from a class will occupy equal number of bytes in memory

4. A class can contain Friend functions.


5. A class is a blueprint or a template according to which objects are created

a. 1, 3, 5 b. 2, 4 c. 3, 5 d. 2, 4, 5