.NET MCQ_13
Short Description
TYBSc IT MCQ que....
Description
Unit – I MCQ Q.1 ___________ namespace 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 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} the______class. Q.12 Every class directly or indirectly extends the______class.
a) System b) Object c) Drawing d) Console Q.13 Polymorphism occurs 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 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 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 t he 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 an example example of static polymorphism b. Function overloading overloadi ng is an example of dynamic polymorphism c. Operator overloading is an example of dynamic dynamic polymorphism 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 overloaded then C# rules enforce that!= (inequality (inequality operator operator ) also also be overloaded d. If the + operator is overloaded then += works automatically 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. code. b.) as much ASP.NET ASP.NET code as is in the ASP.NET file. c.) a mix of ASP.NET and HTML code. d.) all HTML 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.
Queue BitArray ArrayList Hashtable
a. b. c. d.
1 and 2 only 3 and 4 only 5 only 1,2 and 5 only
Stack
Q.7 In a HashTable a HashTable Key cannot be null, but Value can be.
a. True b. False
Q.8 Which of the following statements 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(), Push() , we should write "b" in place of 'b'. '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 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 an ArrayList Collection 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 tr ansmitted 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 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 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 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 b.Common Language Runtime c. Common Language Infrastructure d.Component 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, b.3, 5 c. 1, 4, 5 d.3, 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 exe cuting 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 exe cuting Distributed Applications.
d.It 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 b.Friend Assemblies c. Shared Assemblies d.Public 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 information server 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 i nstance of the _____________class. _____________class. A) System.Web.UI.Page System.Web.UI.Page B) System.Web C) System.Web.Securiy System.Web.Securiy D) System.Configuration System.Configuration Q.21 What is the last stage of the Web forms lifecycle? A) Event Handling 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 page is being requested requested not data data being submitted submitted to web server? server? A. FirstGet B. Initialized
C. IncludesData D. IsPostBack Q.23 In Which Page Cycle All Controls Are Fully Loaded? A) Page_Load() 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. b. mystyle.css c. Q.26 What are the three methods of implementing 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 i tems 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) Application_End b) Application_Error c) Application_Start
d) Application_LogRequest Q 4. The ______ event is raised when the application stops or shuts down a) Application_Start b) Application_End
c) Application_Error d) Application_LogReequest Q 5. The _________ event is raised when an unhandled error occurs and rises up the application scope a) Application_Start b) Application_End c) Application_Error
d) Application_LogReequest
Q.6 Which of the following statements is correct about a namespace in C#.NET?
a. Namespac Namespaces es 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. 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) HTML Server Controls
b) Web Controls c) Validation Controls d) List Controls Q 9. HTML server controls are derived from ______________ ______________ class a) System.Web.UI.HtmlControls.HtmlControl
b) System.Web.UI.WebControls.WebControl c) System.Validation.Control d) System.Web.UI.HtmlControl Q 10. The __________ controls have a standardized set of property names a) Html Server Controls b) Web Controls
c) List Controls d) Validation Controls Q 11. Web controls are derived from ______________ ______________ class a) System.Web.UI.HtmlControls.H System.Web.UI.HtmlControls.HtmlControl tmlControl b) System.Web.UI.WebControls.WebControl
c) System.Validation.Control d) 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.
C-sharp VB C++
d.
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) HTML Server Controls b) Web Controls c) Validation Controls d) List Controls
Q 14. ASP.NET provides a few task specific controls called as ___________ controls controls a) Web Controls b) Rich Controls
c) Validation Controls d) 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.
HTML
b. c. d.
XML WML JSP
Q 16. The Asp.net server control, which provides an alternative way of displaying text on web page, is a.
< asp:label >
b. c. d.
< 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 Console.WriteLine((float)x+y*z-(x+=(short) +y*z-(x+=(short)y)); 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) Label
b) LinkLabel c) TextBox d) ToolTip Q 21. A ____________ ____________ control can display a hyperlink a) Label b) LinkLabel
c) TextBox d) ToolTip Q 22. The ____________ control does not participate in user input or capture mouse or k eyboard events a) Label b) LinkLabel
c) TextBox d) ToolTip Q 23. The ____________ property of the TextBox control is used to mask characters entered in single version of the control a) PasswordChar
b) Length c) MultiLine d) 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) TextBox b) LinkLabel c)
ListView
d) 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) CheckBox b) TabControl
c) ListView d) TextBox Q 27. __________ is one of the t he easiest way to access program functions a) TextBox b) CheckBox c) RadioButton d) ToolBars
Q 28. __________ are small messages which are displayed when a mouse pointer moves over a control a) ToolTip
b) Message c) MessageBox d) 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 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
member function.. 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 i n 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
View more...
Comments