1.
Which of the following code should we write to terminate from the For statement in VB.NET
Correct Answer
C. Exit For
Explanation
In VB.NET, the correct code to terminate from the For statement is "Exit For". This statement allows the program to exit the loop and continue with the next line of code after the loop. "Exit" and "Break" are not valid keywords in VB.NET for terminating a For loop. "Close" is used to close a file or a database connection, but it does not terminate a loop.
2.
Which of the method is used to display the form as modal
Correct Answer
C. ShowDialog()
Explanation
The ShowDialog() method is used to display a form as modal. When this method is called, it opens the form and prevents the user from interacting with any other form in the application until the modal form is closed. This is useful when the user needs to complete a specific task or provide input before continuing with the rest of the application.
3.
What is the default access modifier for an interface
Correct Answer
A. Internal
Explanation
The default access modifier for an interface is "internal". This means that the interface can only be accessed within the same assembly or project. It cannot be accessed by code in other assemblies or projects.
4.
Is it possible to make Enter key work as Tab Key in Datagridview?
Correct Answer
B. We have to inherit Datagridview class and override ProcessDataGridViewKey and ProcessDialogKey methods
Explanation
By inheriting the DataGridView class and overriding the ProcessDataGridViewKey and ProcessDialogKey methods, it is possible to make the Enter key work as the Tab key in the DataGridView. These methods allow custom handling of key events in the DataGridView, providing the opportunity to change the behavior of the Enter key to mimic that of the Tab key.
5.
Vb.Net classes can be derived in C#?
Correct Answer
A. True
Explanation
Yes, Vb.Net classes can be derived in C#. Both Vb.Net and C# are part of the .NET framework and they share the same underlying Common Intermediate Language (CIL). This means that classes written in Vb.Net can be used and derived in C# without any issues. The interoperability between the two languages allows developers to choose the language they are most comfortable with while still being able to utilize code written in the other language.
6.
Which of the following is not a method of Debug class?
Correct Answer
B. Open()
Explanation
The method "Open()" is not a method of the Debug class. The Debug class in programming is used for debugging purposes and provides various methods to assist in debugging, such as Flush(), which is used to flush the output buffer, and Assert(), which is used to check if a condition is true and throws an exception if it is false. However, there is no method called "Open()" in the Debug class.
7.
The tool provided with .Net framework to register assemblies for use by COM is?
Correct Answer
C. Regasm
Explanation
Regasm is the tool provided with .Net framework to register assemblies for use by COM. It is used to create the necessary registry entries for COM interoperability, allowing COM clients to access .Net assemblies. Regasm generates a type library and registers the assembly as a COM component, making it accessible to COM clients.
8.
Which is the best to retrieve Read-Only, Forward-only stream of data from database?
Correct Answer
C. DataReader
Explanation
The best way to retrieve a Read-Only, Forward-only stream of data from a database is by using a DataReader. Unlike a DataAdapter or a DataSet, a DataReader provides a lightweight and efficient means of accessing data in a forward-only manner, making it ideal for scenarios where you only need to read data sequentially and don't require the ability to update or modify the data. A DataExecutor is not a valid option for retrieving data from a database.
9.
How do you implement private interfaces?
Correct Answer
C. Private interfaces can not be implemented
Explanation
Private interfaces cannot be implemented because private interfaces are not intended to be accessed or used by other classes or objects. They are only meant to be used within the same class or within the same package. Therefore, there is no need to implement private interfaces in other classes.
10.
There are 4 types of authentications. 1.WINDOWS AUTHENTICATION 2.FORMS AUTHENTICATION 3.PASSPORT AUTHENTICATION 4.NONE/CUSTOM AUTHENTICATION
Correct Answer
A. True
Explanation
The given statement is true because there are indeed four types of authentications: Windows authentication, Forms authentication, Passport authentication, and None/Custom authentication. These different types of authentications provide various ways for users to verify their identities and gain access to systems or applications.
11.
Difference between Static and read only variable?
Correct Answer
C. Static variable is a variable that retains the same data throughout the execution of a program. Read only variable is one whose value never changed.
Explanation
Static and read-only variables are not the same. A static variable retains the same data throughout the execution of a program, meaning its value can be changed during runtime. On the other hand, a read-only variable is one whose value never changes and remains constant throughout the program's execution.
12.
Which of the following Types will have data of fixed size?
Correct Answer
A. Value Type
Explanation
Value types in programming languages typically have a fixed size because they directly store their data in memory. This means that the memory required for a value type variable is allocated when the variable is declared, and it remains constant throughout the program's execution. In contrast, reference types store a reference to an object in memory, rather than the actual data, and therefore their size can vary depending on the size of the object being referenced. Data types is a broad term that encompasses both value types and reference types, so it does not necessarily have a fixed size. Therefore, the correct answer is Value Type.
13.
Which of the following class does not belong to Collection namespace?
Correct Answer
B. DictionaryList
Explanation
The class "DictionaryList" does not belong to the Collection namespace because it is not a standard class in the .NET Framework's Collection namespace. The other classes mentioned in the options (ArrayList, Queue, and Stack) are all part of the Collection namespace and are commonly used data structures in C#.
14.
How do you create a Read only Property in VB.NET?
Correct Answer
C. Using Only Get..EndGet with in property definition
Explanation
To create a read-only property in VB.NET, you can use the "Using Only Get..EndGet with in property definition" option. This means that you only provide a Get accessor for the property, which allows you to retrieve the value of the property but not set it. This ensures that the property can only be read and not modified.
15.
How do you prevent the class from being inheritance?
Correct Answer
A. Include the keyword ‘NotOverridable’ in front of the class keyword.
Explanation
To prevent a class from being inherited, the keyword 'NotOverridable' should be included in front of the class keyword. This keyword ensures that the class cannot be overridden or inherited by any other class. By using 'NotOverridable', the class becomes sealed and cannot be extended or inherited.
16.
Enter key work by default as Tab key in all controls?
Correct Answer
B. False
Explanation
The given answer is False. By default, the Enter key does not act as the Tab key in all controls. The Enter key is typically used to submit or confirm a form, while the Tab key is used to navigate between different controls on a form. However, the behavior of the Enter key can be customized in certain cases to mimic the Tab key's functionality, but this is not the default behavior.
17.
Can we create the web service in windows application?
Correct Answer
A. Yes
Explanation
Yes, we can create a web service in a Windows application. Windows applications can host and consume web services using technologies such as ASP.NET, WCF (Windows Communication Foundation), and RESTful APIs. These technologies allow developers to create and deploy web services within a Windows application, enabling communication and interaction with other applications and systems over the internet.
18.
What is the root class in .Net ?
Correct Answer
B. System.Object
Explanation
The root class in .Net is System.Object. This class serves as the base class for all other classes in .Net. It provides a set of common methods and properties that are inherited by all other classes. All classes in .Net ultimately inherit from System.Object, either directly or indirectly.
19.
Which of the following abbreviations is incorrectly expanded?
Correct Answer
C. CAS - Component Authorization Specification
Explanation
The incorrect expansion is CAS - Component Authorization Specification. The correct expansion for CAS is Code Access Security.
20.
What is the way to stop a long running thread?
Correct Answer
A. Thread.Abort ( )
Explanation
The correct answer is Thread.Abort(). This method is used to stop a long running thread in C#. It raises a ThreadAbortException in the thread, which can be caught and handled by the thread if necessary. However, it is generally not recommended to use Thread.Abort() as it can leave the application in an inconsistent state. It is better to use other mechanisms like signaling or cancellation tokens to gracefully stop a thread.
21.
Can we store multiple data types in System.Array?
Correct Answer
A. No
Explanation
The System.Array class in C# is a collection of elements of the same data type. It is not designed to store multiple data types. If we need to store multiple data types, we can use other collection classes like List or create a custom class to hold different data types.
22.
Which of the following variables can be defined at compile time and cannot be changed at runtime?
Correct Answer
B. Const
Explanation
The correct answer is "Const". Const variables are defined at compile time and their values cannot be changed at runtime. Once a const variable is assigned a value, it remains constant throughout the execution of the program. This allows for the creation of variables that are known to be constant and cannot be accidentally modified, providing a level of safety and predictability in the code.
23.
How many Clusted indexes a table can have?
Correct Answer
C. 1
Explanation
A table can have only one clustered index. This is because a clustered index determines the physical order of data in a table. It defines the way data is stored on disk, and therefore, there can only be one way to physically order the data. Having multiple clustered indexes would contradict this concept and result in conflicts.
24.
What is maximum number of sub queries we can write in query in SQL Server
Correct Answer
A. 32
Explanation
The maximum number of subqueries that can be written in a query in SQL Server is 32. This means that within a single query, you can include up to 32 subqueries to retrieve data from multiple tables or perform complex calculations. Having a limit on the number of subqueries helps to maintain query performance and prevent excessive nesting of queries, which can lead to slower execution times.
25.
How many null values will be allowed by unique key per table?
Correct Answer
B. Only one null value
Explanation
A unique key in a table ensures that each value in the key column(s) is unique and not null. Therefore, only one null value will be allowed by a unique key per table.
26.
Which tool is used to build the project or solution in .NET?
Correct Answer
B. Msbuild.exe
Explanation
Msbuild.exe is the correct answer because it is a command-line tool used for building projects or solutions in .NET. It is part of the Microsoft Build Engine and is responsible for compiling and linking source code files, managing dependencies, and producing the final executable or library. It is widely used in the .NET development process and provides various options and customization capabilities for building projects.
27.
Default version of an assembly?
Correct Answer
D. 1:0:0:0
Explanation
The default version of an assembly is typically represented as 1:0:0:0. This version number follows the format of major version:minor version:build number:revision number. In this case, the major version is 1, the minor version is 0, and the build number and revision number are both 0. This default version is often used when an assembly is initially created and has not yet undergone any updates or revisions.
28.
Which query we can use to retrieve all the tables in a database?
Correct Answer
D. All the above
Explanation
The correct answer is "All the above". This is because all three queries mentioned in the options can be used to retrieve all the tables in a database. The first query "SELECT * FROM information_schema.tables" retrieves all the tables from the information_schema database. The second query "Select name from sysobjects where type='u' order by name" retrieves all the user-defined tables from the database. The third query "Sp_tables" is a stored procedure that can be used to retrieve all the tables in a database.
29.
What are different type of Collation Sensitivity ?
Correct Answer
D. All of Above
Explanation
The different types of collation sensitivity include case sensitivity, accent sensitivity, and width sensitivity. Case sensitivity refers to the distinction between uppercase and lowercase letters when sorting or comparing characters. Accent sensitivity involves considering the differences between accented and unaccented characters. Width sensitivity takes into account the differences between full-width and half-width characters. "All of Above" is the correct answer because it encompasses all three types of collation sensitivity mentioned.
30.
How do we get last error occurred in Database?
Correct Answer
D. @@error
Explanation
The correct answer is @@error. In SQL Server, @@error is a system function that returns the error number of the last error that occurred. It is used to check if an error occurred during the execution of the previous Transact-SQL statement. By using @@error, we can handle and troubleshoot errors in the database operations effectively.
31.
How will you throw exception from stored procedure?
Correct Answer
A. @@raiseerror
Explanation
The correct answer is "@@raiseerror" because it is a system variable in SQL Server that can be used to throw an exception from a stored procedure. By using this variable, we can raise custom error messages with specific error codes and severity levels, providing more detailed information about the error that occurred. This allows for better error handling and troubleshooting in stored procedures.
32.
In SQL Server Join puts data from two or more tables into a single result set.
Correct Answer
A. True
Explanation
Join in SQL Server is used to combine rows from two or more tables based on a related column between them. It retrieves data from multiple tables and creates a single result set that includes columns from all the tables involved in the join. Therefore, the statement "Join puts data from two or more tables into a single result set" is true.