1.
CLR is the .NET equivalent of
Correct Answer
A. Java Virtual Machine
2.
The reason that C# does not support multiple inheritances is because of
Correct Answer
B. Name collision
Explanation
C# does not support multiple inheritances because of name collision. In multiple inheritance, a class can inherit from multiple parent classes, which can lead to conflicts when two or more parent classes have methods or properties with the same name. This results in ambiguity and makes it difficult for the compiler to determine which method or property to use. To avoid this issue, C# only allows single inheritance, where a class can inherit from only one parent class.
3.
Web Forms consists of a _______ and a _________ .
Correct Answer
A. Template, Component
Explanation
Web Forms consists of a template and a component. A template is a predefined structure or layout that defines the overall appearance of the form, including its fields and controls. A component, on the other hand, is a reusable element that can be added to the form, such as a button or a text box. Together, the template and component work together to create a functional and visually appealing web form.
4.
Which of the following is the root of the .NET type hierarchy
Correct Answer
B. System.Object
Explanation
The root of the .NET type hierarchy is System.Object. In .NET, all types inherit from the Object class, making it the base class for all other classes. This means that every type in .NET, whether it is a built-in type or a user-defined type, ultimately derives from the Object class. This provides a common set of methods and properties that are available to all objects in .NET, such as ToString(), GetHashCode(), and Equals().
5.
Objects can not be created for ------------------- class
Correct Answer
C. Abstract
Explanation
Objects cannot be created for abstract classes. Abstract classes are designed to be inherited by other classes and serve as a blueprint for those classes. They cannot be instantiated directly because they may contain abstract methods that are not implemented. In order to create an object, a class must be concrete, meaning it can be instantiated and all its methods are implemented. Therefore, abstract classes cannot be instantiated and objects cannot be created for them.
6.
Different ways a method can be overloaded in C#.NET
Correct Answer
D. All of above
Explanation
In C#.NET, a method can be overloaded in different ways. One way is by using different parameter data types, which means having the same method name but with different data types for the parameters. Another way is by using a different order of parameters, where the parameters are rearranged in a different order while keeping the same method name. Additionally, a method can also be overloaded by having a different number of parameters, meaning having the same method name but with a different number of parameters. Therefore, the correct answer is "All of above" as all these ways can be used to overload a method in C#.NET.
7.
Which of the following constitutes the .NET Framework?
1. ASP.NET Applications
2. CLR
3. Framework Class Library
4. WinForm Applications
5. Windows Services
Correct Answer
C. 2,3
Explanation
The .NET Framework consists of the CLR (Common Language Runtime), which is the execution environment that manages and executes .NET applications, and the Framework Class Library, which is a collection of reusable classes, interfaces, and value types that provide functionality to .NET applications. Therefore, the correct answer is 2,3.
8.
Private Button print = new button();
Correct Answer
E. Both 1 and 3
Explanation
The given code "Private Button print = new button();" both creates and instantiates a button control. The keyword "new" is used to create a new instance of the button class, and the variable "print" is assigned to this new instance. Therefore, options 1 and 3 are correct. Option 2, "initializes a button control," is not accurate because the button control is both created and instantiated in this line of code.
9.
Class Test: Form { }
Correct Answer
B. Creates the class Test that inherits the class Form
Explanation
The given correct answer suggests that the code snippet creates a class called "Test" which inherits from the class "Form". This means that the class "Test" will have access to all the properties and methods of the class "Form" and can also override or add its own functionalities.
10.
A delegate defines
Correct Answer
C. A class that encapsulates methods
Explanation
A delegate is a class that encapsulates methods. It provides a way to reference and invoke methods dynamically at runtime. By using delegates, you can pass methods as parameters to other methods, store them in variables, and invoke them when needed. This allows for greater flexibility and extensibility in programming.
11.
Which of the following control can contain other controls?
Correct Answer
D. All of the above
Explanation
All of the given controls (Groupbox, Tabpage, and Panel) can contain other controls. Groupbox is a container control that can hold other controls within it. Tabpage is a control used in tab controls, and it can contain other controls as its content. Panel is a container control that can hold and organize other controls within it. Therefore, all three controls can contain other controls, making the answer "All of the above" correct.
12.
Which of the following object is used by the DataAdapter to retrieve the data from database?
Correct Answer
A. Command
Explanation
The DataAdapter uses the Command object to retrieve data from the database. The Command object is responsible for executing SQL queries or stored procedures and returning the result set. It provides methods to set the query or stored procedure, parameters, and connection to the database. The DataAdapter uses the Command object to execute the query and retrieve the data, which is then stored in a DataSet or DataTable for further manipulation and display.
13.
Boxing in .Net allows the user to convert
Correct Answer
C. A value type to a reference type
Explanation
Boxing in .Net refers to the process of converting a value type to a reference type. This is done by wrapping the value type in an object. Boxing is necessary when a value type needs to be treated as an object, such as when it needs to be passed as a parameter to a method that accepts objects. The boxed value can then be unboxed to retrieve the original value type. This process allows for flexibility in handling different types of data in .Net.
14.
Can you store multiple data types in System.Array?
Correct Answer
A. True
Explanation
Yes, you can store multiple data types in System.Array. This is because System.Array is a base class for all arrays in C#, and it allows you to store elements of different data types in a single array. This is achieved by using the common base type Object, which all other data types inherit from. So, you can store integers, strings, booleans, or any other data type in a System.Array.
15.
What is the .NET collection class that allows an element to be accessed using a unique key?
Correct Answer
A. HashTable
Explanation
The .NET collection class that allows an element to be accessed using a unique key is the HashTable. A HashTable is a data structure that uses a hash function to map keys to values. It provides fast access to elements by their unique keys, making it efficient for retrieving and storing data.
16.
What does the keyword virtual mean in the method definition?
Correct Answer
D. The method can be over-ridden
Explanation
The keyword "virtual" in a method definition indicates that the method can be overridden in a derived class. This means that a subclass can provide its own implementation of the method, which will be used instead of the implementation in the base class. This allows for polymorphism, where different objects of the same base class can have different behaviors for the same method.
17.
Which of the following prevent your class from being inherited by another class?
Correct Answer
C. The keyword “sealed” will prevent the class from being inherited.
Explanation
The keyword "sealed" in C# is used to prevent a class from being inherited by another class. When a class is marked as sealed, it cannot be used as a base class for any other class. This means that no other class can derive from it and inherit its members. Therefore, the keyword "sealed" is the correct answer as it explicitly prevents the class from being inherited.
18.
From a dataview dv who has a column “EmpNo” from employee table, how will u bind a textbox
Correct Answer
C. Textbox.databinding.add(“Text”,dv,”EmpNo”);
Explanation
The correct answer is "Textbox.databinding.add('Text',dv,'EmpNo');". This is because the code is binding the "EmpNo" column from the "dv" dataview to the "Text" property of the Textbox.
19.
Using or Imports statement
Correct Answer
B. Use to reference an external library
Explanation
The correct answer is "use to reference an external library." The using or Imports statement is used in programming languages to import external libraries or namespaces. It allows us to reference the members of those libraries without using their fully qualified names. This helps in simplifying the code and making it more readable by avoiding repetitive and lengthy naming conventions.
20.
Which of the following does the actual .Net code execute?
Correct Answer
D. CLR
Explanation
The actual .Net code executes in the CLR (Common Language Runtime). The CLR is responsible for managing the execution of .Net programs, including memory management, security, and exception handling. It compiles the MSIL (Microsoft Intermediate Language) code into machine code that can be executed by the computer's processor. The CLR also provides services such as garbage collection and type safety through the CTS (Common Type System). The CLS (Common Language Specification) is a set of rules that ensures interoperability between different .Net languages, but it is not directly involved in the execution of the code.
21.
Visual Basic maintains a project file with the extension…..
Correct Answer
B. .vbp
Explanation
Visual Basic maintains a project file with the extension .vbp. This file is used to store information about the project, such as the names and locations of all the files associated with the project, the project settings, and references to external libraries. The .vbp file is essential for managing and organizing the project in Visual Basic.
22.
………… indicates whether a particular condition is on or off.
Correct Answer
C. Check Box
Explanation
Check Box is the correct answer because it is a user interface element that allows the user to select one or more options from a set of choices. It is typically used to indicate whether a particular condition is on or off. The other options listed (Combo box, List Box, Option Tab) do not have the same functionality as a Check Box and are not typically used to indicate the on/off status of a condition.
23.
The default datatype for VB is …………………..
Correct Answer
A. Variant
Explanation
The default datatype for VB is Variant. This means that if no specific datatype is declared for a variable, it will automatically be assigned the Variant datatype. Variant allows the variable to hold different types of data, such as numbers, strings, or objects. It provides flexibility but can also lead to potential issues if not used carefully.
24.
……….. is one of the main building blocks in a VB application
Correct Answer
C. Form
Explanation
In a VB application, a form is one of the main building blocks. A form is a graphical user interface that allows users to interact with the application. It contains various controls such as buttons, text boxes, and labels, which can be used to create a user-friendly interface. Forms can be used to display information, receive user input, and perform actions based on user interactions. Therefore, a form plays a crucial role in the overall functionality and user experience of a VB application.
25.
Which two controls can be combined to form the ComboBox control?
Correct Answer
A. ListBox and TextBox
Explanation
The ComboBox control is a combination of a ListBox and a TextBox. The ListBox is used to display a list of options, and the TextBox is used to allow the user to enter custom text. By combining these two controls, the ComboBox provides a dropdown list with the option to enter custom text.
26.
………… can access data from relational and non relational databases.
Correct Answer
C. OLEDB
Explanation
OLEDB is a data access technology that provides a consistent interface for accessing data from different types of databases, including both relational and non-relational databases. It allows applications to access data using a set of standard interfaces, regardless of the specific database management system being used. This makes it a suitable choice for accessing data from various types of databases. OLEDB is not limited to only relational databases, unlike the Jet database engine which is primarily designed for accessing Microsoft Access databases. ODBC is also a data access technology, but it is primarily focused on accessing relational databases. Therefore, OLEDB is the correct answer as it can access data from both relational and non-relational databases.
27.
To attach a scroll bar to the textbox , the property of textbox should be set to:
Correct Answer
C. Multiline=True
Explanation
To attach a scroll bar to the textbox, the property of the textbox should be set to Multiline=True. This property allows the textbox to have multiple lines of text, which in turn enables the display of a scroll bar when the content exceeds the visible area of the textbox. By setting Multiline=True, the textbox becomes capable of displaying and scrolling through multiple lines of text, making it suitable for situations where longer text input is expected.
28.
………. Allows access to the client server databases on a network
Correct Answer
A. ODBC
Explanation
ODBC (Open Database Connectivity) is a standard programming interface that allows applications to access client-server databases on a network. It provides a set of functions for connecting to and querying databases, regardless of the specific database management system being used. ODBC acts as a bridge between the application and the database, allowing the application to send SQL queries and retrieve data from the database. Therefore, ODBC is the correct answer as it specifically enables access to client-server databases on a network.
29.
what is the output of the following code?
using System;
class program
{
static void Main(string[] args)
{
int[] arr = new int[] {1 ,2 ,3 ,4 ,5 };
fun1(ref arr);
Console.ReadLine();
}
static void fun1(ref int[] array)
{
for (int i = 0; i < array.Length; i=i+2)
{
array[i] = array[i] + 10;
}
Console.WriteLine(string.Join(",", array));
}
}
Correct Answer
C. 11 2 13 4 15
Explanation
The code defines an array called "arr" with elements 1, 2, 3, 4, and 5. It then calls the function "fun1" and passes the array as a reference.
In the "fun1" function, a for loop is used to iterate through the elements of the array. It increments the index by 2 in each iteration. Inside the loop, it adds 10 to the value of the element at the current index.
After the loop, the function prints the modified array using the "Console.WriteLine" method.
Therefore, the output of the code will be "11 2 13 4 15".
30.
What will be the output of the following code snippet?
using System;
class program
{
static void Main(string[] args)
{
int x = 4 ,b = 2;
x -= b/= x * b;
Console.WriteLine(x + " " + b);
Console.ReadLine();
}
}
Correct Answer
B. 4 0
Explanation
The code snippet assigns the value of 4 to variable x and 2 to variable b. Then, it divides b by the product of x and b, which is 8. The result of the division is 0, which is then assigned back to b. Finally, x is subtracted by the value of b, which is 0. Therefore, the output of the code will be "4 0".