Home
MCQS
C MCQ Quiz Hub
Choose a topic to test your knowledge and improve your C skills
1. Which of these can be overloaded?
Constructors
Methods
Both a & b
None of the mentioned
2. Number of constructors a class can define of ?
1
2
Any number
None of the mentioned discuss
3. Correct statement about constructors in C#.NET is ?
Constructor cannot be overloaded
Constructor allocate space for object in memory
Constructor are never called explicitly
Constructor have same name as name of the class
4. Constructors are used to
initialize the objects
construct the data members
both a & b
None of the mentioned
5. To overload a method which of the following statement is false?
If the return type is different methods are overloaded
Name of the overloaded method should be same
Type of the parameter should be different
Order of the parameter should be different if types are same
6. What is return type of constructors?
int
float
void
None of the mentioned
7. Which method have same name as that of its class?
A. delete
class
constructor
None of the mentioned
8. Which of following statement are correct about functions?
C# allows a function to have arguments with default values
Redefining a method parameter in the method’s body causes an exception
C# allows function to have arguments of private type
Omitting the return type in method definition results into exception
9. Which of the following statements are correct about an ArrayList collection thatimplements the IEnumerable interface? 1. The ArrayList class contains an inner class that implements the IEnumerator interface. 2. An ArrayList Collection cannot be accessed simultaneously by different threads. 3. The inner class of ArrayList can access ArrayList class's members. 4. To access members of ArrayList from the inner class, it is necessary to pass ArrayList class's reference to it. 5. Enumerator's of ArrayList Collection can manipulate the array.
1 and 2 only
1,3 and 4 only
2 and 5 only
None of the above
10. How many enumerators will exist if four threads are simultaneously working on an ArrayList object?
1
3
2
4
11. In which of the following collections is the Input/Output index-based? 1. Stack 2. Queue 3. BitArray 4. ArrayList 5. HashTable
1 and 2 only
3 and 4 only
5 only
1, 2 and 5 only
12. Which of the following statements are correct about the Stack collection? 1. It can be used for evaluation of expressions. 2. All elements in the Stack collection can be accessed using an enumerator. 3. It is used to maintain a FIFO list. 4. All elements stored in a Stack collection must be of similar type. 5. Top-most element of the Stack collection can be accessed using the Peek() method.
1 and 2 only
3 and 4 only
1, 2 and 5 only
All of the above
13. Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below? Queue q = new Queue(); q.Enqueue("Sachin"); q.Enqueue('A'); q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4)
IEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
IEnumerator e; e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
IEnumerator e; e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
14. Which of the following statements are correct about the delegate declaration given below? delegate void del(int i); 1. On declaring the delegate a class called del will get created. 2. The signature of del need not be same as the signature of the method that we intend to call using it. 3. The del class will be derived from the MulticastDelegate class. 4. The method that can be called using del should not be a static method. 5. The del class will contain a one-argument constructor and an lnvoke() method
1, 2 and 3 only
1, 3 and 5 only
2 and 4 only
4 only
15. Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type (Integer, Single, Byte etc.). Which of the following programming constructs should be used to implement the comparison function?
Namespace
Interface
Encapsulation
Delegate
16. What is a delegate?
A strongly typed function pointer.
A light weight thread or process that can call a single method.
A reference to an object in a different process.
An inter-process message channel.
17. Which of the following is included in Visual Studio IDE?
Form Designer
Code Editor
Solution Explorer
All of the above
18. Which of the following is true about dispose() method?
A. This method is protected.
Its return type is int.
It accepts a float parameter.
All of the above
19. Button class derives from
Checkbox
RadioButton
ButtonBase
None of the above
20. Which namespace includes most of the Control classes for developing Windows applications?
System;
System.Windows.Controls
System.Windows.Components.Forms
System.Windows.Forms
21. Which of the Control objects is viewed as a container that can hold other objects when you design a Windows application?
Control
Button
Window
Form
22. When an instance method declaration includes the abstract modifier, the method is said tobe an ______.
Abstract method
Instance method
Sealed method
Expression method
23. The theory of _____ implies that user can control the access to a class, method, orvariable.
Data hiding
Encapsulation
Information Hiding
Polymorphism
24. Inheritance is ______ in nature.
Commutative
Associative
Transitive
Iterative
25. The point at which an exception is thrown is called the _______
Default point
Invoking point
Calling point
Throw point
26. In C#, having unreachable code is always an _____.
Method
Function
Error
Iterative
27. C# treats the multiple catch statements like cases in a _____________ statement.
If
Switch
For
While
28. C# supports a technique known as________, which allows a method to specify explicitlythe name of the interface it is implementing.
Method Implementation
Implicit Interface Implementation
Explicit Interface Implementation
Iterative Interface Implementation
29. The reason that C# does not support multiple inheritances is because of ______.
Method collision
Name collision
Function collision
Interface collision
30. _______ is a set of devices through which a user communicates with a system using interactive set of commands.
Console
System
Keyboard
Monitor
31. Exponential formatting character (‘E’ or ‘e’) converts a given value to string in the form of _______.
m.dddd
E+xxx
m.dddd
E+xxx
32. The ______ are the Graphical User Interface (GUI) components created for web basedinteractions..
Web forms
Window Forms
Application Forms
None of the above
33. In Microsoft Visual Studio, ______ technology and a programming language such as C#is used to create a Web based application.
JAVA
J#
VB.NET
ASP.NET
34. The controls available in the tool box of the ______ are used to create the user interface of a web based application.
Microsoft visual studio IDE
Application window
Web forms
None of the above
35. Web Forms consists of a _______ and a _________ .
Template, Component
CLR, CTS
HTML Forms, Web services
Windows, desktop
36. The ______ parentheses that follow _____ indicate that no information is passed to Main().
Empty, class
Empty, submain
Empty, Main
Empty, Namespace
37. The scope of a variable depends on the ____________ and _________.
Main method, place of its declaration
Type of the variable, console
compiler, main
Type of the variable, place of its declaration
38. Which of the following statements is correct about the C#.NET code snippet given below?class Student s1, s2; // Here 'Student' is a user-defined class. s1 = new Student(); s2 = new Student();
Contents of s1 and s2 will be exactly same.
The two objects will get created on the stack.
Contents of the two objects created will be exactly same.
The two objects will always be created in adjacent memory locations.
39. Which of the following can be facilitated by the Inheritance mechanism? 1 Use the existing functionality of base class. 2 Overrride the existing functionality of base class. 3 Implement new functionality in the derived class. 4 Implement polymorphic behaviour. 5 Implement containership.
1, 2, 3
3, 4
2, 4, 5
3, 5
40. Which of the following should be used to implement a 'Has a' relationship between twoentities?
Polymorphism
Templates
Containership
Encapsulation
41. Which of the following should be used to implement a 'Like a' or a 'Kind of' relationshipbetween two entities?
Polymorphism
Containership
Templates
Inheritance
42. How can you prevent inheritance from a class in C#.NET ?
Declare the class as shadows. B. C.
Declare the class as overloads.
Declare the class as seal
None of the above
43. A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?
12 bytes
24 bytes
0 bytes
8 bytes
44. Which of the following statements is correct about Interfaces used in C#.NET?
All interfaces are derived from an Object class.
Interfaces can be inherited.
All interfaces are derived from an Object interface.
Interfaces can contain only method declaration
45. Which of the following statements is correct about an interface used in C#.NET?
If a class implements an interface partially, then it should be an abstract class.
Class cannot implement an interface partially.
An interface can contain static methods.
An interface can contain static data.
46. Which of the following statements is correct about an interface?
One interface can be implemented in another interface.
An interface can be implemented by multiple classes in the same program.
A class that implements an interface can explicitly implement members of that interface.
The functions declared in an interface have a body.
47. Databases store information in records, fields and:
data providers
grids
columns
tables
48. Each data provider class is grouped and accessible through its:
namespace
database
datagrid
provider
49. In Visual Studio, the tool that enables you to connect to a database and automatically populate a dataset object using a TableAdapter object is the ___________wizard:
Data Source Configuration
Data Source
Query Builder
DataSet Designer
50. In XML, a document is a hierarchy of
attributes
elements
tags
All of the above
51. Which of the following namespace contains the LINQ to XML?
System.Xml;
System.Data;
System.Xml.Linq;
System.Linq;
52. LINQ to SQL works with
SQL Server
SQL Server Compact 3.5
both (a) and (b)
None of the above
53. A connection string contains
A. a using directive
the name of the data source
the version number of database management system
the list of fields in the database
54. To avoid writing additional SQL statements to update a live database, you instantiate an object of which class?
DataAdapter
DataReader
DataSet
CommandBuilder
55. The following namespaces (System.Data.OleDB, System.Data.SqlClient, System.Data.Odbc, System.Data.OracleClient) include classes for different:
Data providers
File streams
ADO.NET applications
Databases
56. Which of the following is a definition of a database?
It is a collection of related information organized on a computer.
It is single flat file.
It is a file that can only be set up on a single PC.
It is a group of files that can be set up only on a network.
57. A computer application for managing databases and pulling together data to generate reports and make decisions is known as a(n)
. Database System (DS).
File Manager (FM).
Management System (MS)
Database Management System (DBMS).
58. Which of the following characterizes the relational model for databases?
It organizes data into a hierarchal format.
It splits data into separate row and column areas called tables.
It organizes data into one large table.
It organizes data into a network format.
59. A field is a
group of records.
index that locates information in a table.
common characteristic in a table of information.
code that represents a record.
60. Forms and reports, used for entering and editing records, and for generating useful information in reports are
additional database objects.
only useful for complex databases.
difficult to generate.
stored separately from databases.
Submit