.Net Preliminary Test! Check Your Proficiency! Trivia Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By 569461_tcs
5
569461_tcs
Community Contributor
Quizzes Created: 2 | Total Attempts: 588
Questions: 30 | Attempts: 528

SettingsSettingsSettings
DotNET Quizzes & Trivia

Below is a. Net preliminary test perfectly designed to check your proficiency! NET is a framework that provides a programming guidelines that can be used to develop a wide range of applications while making use of different computer languages. By taking the quiz you will get to see if you might need a refresher so as to understand everything about this framework. All the best as you tackle.


Questions and Answers
  • 1. 

    In order to use the for-each statement, what interface needs to be implemented by the target class?

    • A.

      IEnumerable

    • B.

      IEnumerator

    • C.

      ICollection

    • D.

      IList

    Correct Answer
    A. IEnumerable
    Explanation
    The correct answer is IEnumerable. The for-each statement in C# is used to iterate over a collection of items. In order to use this statement, the target class needs to implement the IEnumerable interface. This interface provides the necessary methods for iterating over the collection, such as GetEnumerator(). By implementing IEnumerable, the target class allows its objects to be used in a for-each loop, making it easier to iterate over its elements.

    Rate this question:

  • 2. 

    The .NET Framework provides a run time environment called ..... ?

    • A.

      RMT

    • B.

      RCT

    • C.

      CLS

    • D.

      CLR

    Correct Answer
    D. CLR
    Explanation
    The correct answer is CLR, which stands for Common Language Runtime. The CLR is a component of the .NET Framework that provides a run time environment for executing and managing .NET applications. It provides services such as memory management, exception handling, and security. The CLR also includes a Just-in-Time (JIT) compiler that converts the Intermediate Language (IL) code into machine code for execution.

    Rate this question:

  • 3. 

    Find the term: The .NET framework provides automatic memory management using a technique called ______________ ?

    • A.

      Serialization

    • B.

      Assemblies

    • C.

      Garbage Collection

    • D.

      Overriding

    Correct Answer
    C. Garbage Collection
    Explanation
    The correct answer is Garbage Collection. The .NET framework uses a technique called Garbage Collection to automatically manage memory. Garbage Collection is a process where the runtime environment automatically identifies and frees up memory that is no longer being used by the program. This helps to prevent memory leaks and improves the overall performance and efficiency of the application.

    Rate this question:

  • 4. 

     In .NET the operation of reading metadata and using its contents is known as ______?

    • A.

      Reflection

    • B.

      Enumeration

    • C.

      Serialization

    • D.

      Binding

    Correct Answer
    A. Reflection
    Explanation
    Reflection in .NET refers to the ability of a program to examine and modify its own structure, behavior, and metadata at runtime. It allows the program to dynamically discover and use information about types, methods, properties, and other members of assemblies. Reflection is commonly used for tasks such as loading assemblies dynamically, accessing and invoking methods dynamically, creating instances of types dynamically, and inspecting and modifying attributes and metadata of types. Therefore, the correct answer for the given question is Reflection.

    Rate this question:

  • 5. 

    How many classes can a single .NET DLL contain?

    • A.

      One

    • B.

      Two

    • C.

      Many

    • D.

      None

    Correct Answer
    C. Many
    Explanation
    A single .NET DLL can contain many classes. In .NET, a DLL (Dynamic Link Library) is a file that contains compiled code and resources that can be used by multiple applications. It serves as a container for various classes and other components. These classes can be accessed and utilized by other programs, making it possible to have multiple classes within a single DLL file. Therefore, the correct answer is "Many".

    Rate this question:

  • 6. 

    What is the top .NET class that everything is derived from?

    • A.

      Object

    • B.

      System.Net

    • C.

      System

    • D.

      System.Object

    Correct Answer
    D. System.Object
    Explanation
    The top .NET class that everything is derived from is System.Object. In the .NET framework, all classes are derived from the Object class, which is the root of the class hierarchy. This means that every class in .NET inherits certain properties and methods from the Object class, such as ToString(), GetHashCode(), and Equals(). Therefore, System.Object is the correct answer.

    Rate this question:

  • 7. 

    A variable declared inside a method is called a________variable.

    • A.

      Static

    • B.

      Private

    • C.

      Instance

    • D.

      Local

    • E.

      Both Private and Instance

    Correct Answer
    D. Local
    Explanation
    A variable declared inside a method is called a local variable. Local variables are only accessible within the method or block of code in which they are declared. They are temporary and are destroyed once the method or block of code has finished executing.

    Rate this question:

  • 8. 

    Which of these statements correctly declares a two-dimensional integer array in C#?

    • A.

      Int[,] myArray;

    • B.

      Int[][] myArray;

    • C.

      Int[2] myArray

    • D.

      Int myArray[2];

    Correct Answer
    A. Int[,] myArray;
    Explanation
    The correct answer is "int[,] myArray;". This statement correctly declares a two-dimensional integer array in C#. The "int[,]" syntax indicates that the array is two-dimensional, while "myArray" is the name given to the array.

    Rate this question:

  • 9. 

    Class String and the Char structure found in the:

    • A.

      System.Strings namespace

    • B.

      System.Chars namespace

    • C.

      System.Text namespace

    • D.

      System namespace

    Correct Answer
    D. System namespace
    Explanation
    The correct answer is the System namespace because the System namespace is a root namespace in the .NET framework that contains fundamental classes and base types. It includes classes like String and Char, which are commonly used for manipulating and working with strings and characters. The other namespaces mentioned, such as System.Strings, System.Chars, and System.Text, do not exist in the .NET framework and are not valid namespaces.

    Rate this question:

  • 10. 

    The proper way to convert a string to all lowercase is:

    • A.

      String = string.ToLower(string);

    • B.

      String.ToLower(string);

    • C.

      ToLower(string);

    • D.

      String.ToLower();

    Correct Answer
    D. String.ToLower();
    Explanation
    The correct answer is "string.ToLower();". This is because the ToLower() method is a built-in function in many programming languages that converts a string to all lowercase letters. By calling this method on the string variable directly, we can achieve the desired result of converting the string to lowercase.

    Rate this question:

  • 11. 

    If two StringBuilder objects contain the same string then

    • A.

      They represent the same memory location

    • B.

      If one changes, so will the other

    • C.

      They are two different objects

    • D.

      None of the above

    Correct Answer
    C. They are two different objects
    Explanation
    The given correct answer states that if two StringBuilder objects contain the same string, they are two different objects. This means that even though the two objects may have the same content, they are separate entities in memory. Therefore, any changes made to one StringBuilder object will not affect the other object.

    Rate this question:

  • 12. 

    Find any errors in the following BankAccount constructor:     public int BankAccount() {        balance = 0;     }

    • A.

      Formal parameters

    • B.

      ReturnType

    • C.

      Name

    • D.

      No Errors

    Correct Answer
    B. ReturnType
    Explanation
    The given code snippet is attempting to define a constructor for a BankAccount class. However, constructors do not have a return type, so the "int" return type specified in the code is incorrect. Constructors are used to initialize the object's state and do not return any value. Therefore, the correct answer is "ReturnType".

    Rate this question:

  • 13. 

    In the body of a method, C# uses the keyword named_____ to refer the current instance of a class.

    • A.

      Do

    • B.

      Static

    • C.

      This

    • D.

      Sealed

    Correct Answer
    C. This
    Explanation
    In C#, the keyword "this" is used to refer to the current instance of a class within the body of a method. This allows us to access the members and methods of the current object. By using "this", we can avoid naming conflicts between local variables and instance variables in the class.

    Rate this question:

  • 14. 

    Polymorphism occurs when the methods of the child class

    • A.

      Override the parent class methods but maintain the same 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

    Correct Answer
    B. Maintain the same return type and arguments as the parent class, but implement it differently
    Explanation
    Polymorphism occurs when the methods of the child class maintain the same return type and arguments as the parent class, but implement them differently. This means that the child class can override the implementation of the parent class method while still maintaining the same method signature. This allows for flexibility in the code, as different objects of the same parent class can be treated differently based on their specific implementation of the method.

    Rate this question:

  • 15. 

    ASP.NET separates the HTML output from program logic using a feature named as?

    • A.

      Inline Page Technique

    • B.

      Code Behind

    • C.

      Exception

    • D.

      Code Separation

    Correct Answer
    B. Code Behind
    Explanation
    ASP.NET separates the HTML output from program logic using a feature called Code Behind. This feature allows developers to write the program logic in a separate file, typically with a .cs or .vb extension, while keeping the HTML markup in the .aspx file. This separation enhances the maintainability and readability of the code, as it allows developers to focus on their respective tasks without mixing them together. The Code Behind file contains event handlers, business logic, and other server-side code that interacts with the HTML elements and controls defined in the .aspx file.

    Rate this question:

  • 16. 

    What is the base class from which all Web forms inherit?

    • A.

      Master

    • B.

      Page

    • C.

      Form

    • D.

      WebPage

    Correct Answer
    B. Page
    Explanation
    All Web forms inherit from the base class "Page". This class provides the basic functionality and properties that are common to all web pages. It allows developers to create and customize web pages by adding controls, handling events, and managing the page lifecycle. The "MasterPage" is a separate concept in ASP.NET that allows for creating a consistent layout and design across multiple web pages, but it is not the base class from which all Web forms inherit.

    Rate this question:

  • 17. 

    If one has two different web form controls in a application and wanted to know whether the values in the above two different web form control match.  What control must be used?

    • A.

      CompareValidator

    • B.

      GridView

    • C.

      TextBox

    • D.

      ListView

    Correct Answer
    A. CompareValidator
    Explanation
    The CompareValidator control is used to compare the values of two different web form controls in an application. It allows the developer to specify the type of comparison (e.g. equal, not equal, greater than, etc.) and display an error message if the values do not match. This control is useful in scenarios where data validation is required, such as checking if a password and its confirmation match.

    Rate this question:

  • 18. 

    Which of the following allow writing formatted output?

    • A.

      Response.Write()

    • B.

      Response.Output.Write()

    • C.

      Both

    • D.

      None

    Correct Answer
    B. Response.Output.Write()
    Explanation
    The correct answer is "Both". Both Response.Write() and Response.Output.Write() allow writing formatted output. Response.Write() is a method that writes a string of text directly to the output stream, while Response.Output.Write() is a method that writes formatted text to the output stream. Both methods can be used to display formatted output in a web application.

    Rate this question:

  • 19. 

    Which of the following denote the property in every validation control?

    • A.

      Text

    • B.

      ControlToValidate

    • C.

      ErrorMessage

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The correct answer is "All of the above" because all three options - Text, ControlToValidate, and ErrorMessage - are properties that are present in every validation control. The Text property is used to specify the text that needs to be validated, the ControlToValidate property is used to specify the control that needs to be validated, and the ErrorMessage property is used to specify the error message that is displayed when the validation fails. Therefore, all three properties are essential in every validation control.

    Rate this question:

  • 20. 

    You are a database developer for Woodgrove Bank. You are implementing a process that loads data into a SQL Server database. As a part of this process, data is temporarily loaded into a table named "Staging". When the data load process is complete, the data should be deleted from this table. You will never need to recover this deleted data. You need to ensure that the data from the Staging table is deleted as quickly as possible. What should you do?

    • A.

      Use a DELETE statement to remove the data from the table.

    • B.

      Use a TRUNCATE TABLE statement to remove the data from the table.

    • C.

      Use a DROP TABLE statement to remove the data from the table.

    • D.

      Use an updateable cursor to access and remove each row of data from the table.

    Correct Answer
    B. Use a TRUNCATE TABLE statement to remove the data from the table.
    Explanation
    Using a TRUNCATE TABLE statement is the most efficient way to delete data from a table. Unlike the DELETE statement, which removes rows one by one, the TRUNCATE TABLE statement removes all rows from the table at once. This results in faster deletion and less transaction log usage. The DROP TABLE statement would delete the entire table, including the table structure, which is not required in this scenario. Using an updateable cursor to remove each row one by one would be slower and less efficient compared to using the TRUNCATE TABLE statement.

    Rate this question:

  • 21. 

    You are a database developer for a sales organization. Your database has a table named Sales that contains summary information regarding the sales orders from salespeople. The sales manager asks you to create a report of the salespeople who had the 20 highest total sales.Which query should you use to accomplish this?

    • A.

      SELECT TOP 20 PERCENT LastName, FirstName, SUM (OrderAmount) AS ytd FROM sales GROUP BY LastName, FirstName ORDER BY 3 DESC

    • B.

      SELECT TOP 20 PERCENT LastName, FirstName, MAX (OrderAmount) AS ytd FROM sales GROUP BY LastName, FirstName ORDER BY 3 DESC

    • C.

      SELECT TOP 20 LastName, FirstName, SUM (OrderAmount) AS ytd FROM sales GROUP BY LastName, FirstName ORDER BY 3 DESC

    • D.

      SELECT TOP 20 LastName, FirstName, MAX (OrderAmount) AS ytd FROM sales GROUP BY LastName, FirstName ORDER BY 3 DESC

    Correct Answer
    C. SELECT TOP 20 LastName, FirstName, SUM (OrderAmount) AS ytd FROM sales GROUP BY LastName, FirstName ORDER BY 3 DESC
    Explanation
    This query is the correct answer because it selects the top 20 salespeople based on their total sales. The SELECT statement retrieves the LastName, FirstName, and the sum of the OrderAmount for each salesperson. The GROUP BY clause groups the results by LastName and FirstName, allowing for the calculation of the total sales for each salesperson. The ORDER BY clause sorts the results in descending order based on the third column, which is the sum of the OrderAmount. Finally, the TOP 20 keyword limits the results to the top 20 salespeople with the highest total sales.

    Rate this question:

  • 22. 

    You want to execute a DELETE SQL query on a table in the database. You want to retrieve the number of rows that were deleted. What code should you use?

    • A.

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; cmd.Connection=ConObj; int rowcount = cmd.ExecuteScalar();

    • B.

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; cmd.Connection=ConObj; int rowcount = cmd.ExecuteNonQuery();

    • C.

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; cmd.Connection=ConObj; SqlDataReader dr = cmd.ExecuteReader();

    • D.

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; cmd.Connection=ConObj; int rowcount; cmd.ExecuteNonQuery(out rowcount);

    Correct Answer
    B. SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; cmd.Connection=ConObj; int rowcount = cmd.ExecuteNonQuery();
    Explanation
    The correct answer is to use the "cmd.ExecuteNonQuery()" method. This method is used to execute a SQL query that does not return any data, such as a DELETE query. It returns the number of rows affected by the query, which in this case would be the number of rows deleted from the table.

    Rate this question:

  • 23. 

    You use a DataTable to load data from the Orders Table from a database. The Orders table contains two columns: Quantity, and UnitPrice. You want to add another column, which computes the total price using the formula : TotalPrice=Quantity*UnitPrice. What code will you use to add this third column to the DataTable?

    • A.

      DataTable.Columns.Add(new DataColumn("TotalPrice", typeof(Double), "Quantity" * "UnitPrice"));

    • B.

      DataTable.Columns.Add(new DataColumn("TotalPrice", typeof(Double), Quantity * UnitPrice));

    • C.

      DataTable.Columns.Add(new DataColumn("TotalPrice", typeof(Double), "Quantity * UnitPrice"));

    • D.

      DataTable.Columns.Add(new DataColumn("TotalPrice", typeof(Double), "Quantity", "UnitPrice"));

    Correct Answer
    C. DataTable.Columns.Add(new DataColumn("TotalPrice", typeof(Double), "Quantity * UnitPrice"));
    Explanation
    The correct answer is "dataTable.Columns.Add(new DataColumn("TotalPrice", typeof(Double), "Quantity * UnitPrice"));" because it correctly adds a new column named "TotalPrice" of type Double to the DataTable. The third argument in the DataColumn constructor specifies the expression used to compute the values for the column, which in this case is "Quantity * UnitPrice".

    Rate this question:

  • 24. 

    What tags one need to add within the asp:GridView tags to bind columns manually?

    • A.

      Set AutoGenerateColumns Property to false on the gridview tag

    • B.

      Set AutoGenerateColumns Property to true on the gridview tag

    • C.

      Set AutoManualColumns Property to true on the gridview tag

    • D.

      It is not possible to do that operation

    Correct Answer
    A. Set AutoGenerateColumns Property to false on the gridview tag
    Explanation
    To bind columns manually within the asp:GridView tags, one needs to set the AutoGenerateColumns property to false on the gridview tag. This will disable the automatic generation of columns and allow the user to manually define the columns.

    Rate this question:

  • 25. 

    Which method do you invoke on the DataAdapter control to load your generated dataset with data?

    • A.

      LoadData()

    • B.

      GetData()

    • C.

      FillData()

    • D.

      Fill()

    Correct Answer
    D. Fill()
    Explanation
    The correct answer is Fill(). The Fill() method is used to load a dataset with data from a data source. It takes the dataset as a parameter and populates it with the data retrieved from the data source. This method is commonly used with the DataAdapter control in ADO.NET to retrieve data from a database and fill a dataset for further processing or display.

    Rate this question:

  • 26. 

    Which of the following must be done in order to connect data from some data resource to GridView control?

    • A.

      Set the DataMember Property

    • B.

      Set the DataSource Property

    • C.

      Set the DataTable Property

    • D.

      Call the DataBind Method

    Correct Answer(s)
    B. Set the DataSource Property
    D. Call the DataBind Method
    Explanation
    To connect data from a data resource to a GridView control, the DataSource property needs to be set to specify the source of the data. After setting the DataSource property, the DataBind method should be called to bind the data to the GridView control and display it. The DataMember property is not necessary in this context as it is used to specify a specific table or list within a data source that contains the data to be bound. The DataTable property is also not required as it is used to directly assign a DataTable object to the GridView control.

    Rate this question:

  • 27. 

    Which of the following can be used to add alternating color scheme in a Repeater control?

    • A.

      PageTemplate

    • B.

      ItemTemplate

    • C.

      AlternatingPageTemplate

    • D.

      AlternatingItemTemplate

    Correct Answer
    D. AlternatingItemTemplate
    Explanation
    The AlternatingItemTemplate can be used to add an alternating color scheme in a Repeater control. This template allows for different styling to be applied to the items in the Repeater control, alternating between two different styles. This can be useful for improving the readability and visual appeal of the control, especially when displaying a large number of items.

    Rate this question:

  • 28. 

    Which of the following denote ways to manage state in an ASP.Net Application?

    • A.

      Session

    • B.

      Application

    • C.

      ViewState

    • D.

      All of the Above

    Correct Answer
    D. All of the Above
    Explanation
    Session, Application, and ViewState are all ways to manage state in an ASP.Net Application.

    - Session state allows storing and retrieving values for a user session across multiple requests.
    - Application state allows storing and retrieving values that are accessible to all users of the application.
    - ViewState allows storing and retrieving values for a specific page.

    Therefore, all of the mentioned options (Session, Application, and ViewState) are correct ways to manage state in an ASP.Net Application.

    Rate this question:

  • 29. 

    In ASP.NET the sessions can be dumped by using

    • A.

      Session.Clear

    • B.

      Session.Remove

    • C.

      Session.Abandon

    • D.

      Session.Kill

    Correct Answer
    C. Session.Abandon
    Explanation
    Session.Abandon is the correct answer because it is a method in ASP.NET that is used to abandon the current session and release all resources associated with it. When Session.Abandon is called, the session state is cleared and the session is terminated. This means that all data stored in the session is lost and a new session will be created for the user on their next request. It is commonly used when a user logs out or when their session needs to be forcibly ended.

    Rate this question:

  • 30. 

    In ASP.NET the < authorization > section contain which of the following elements?

    • A.

      < deny >

    • B.

      < allow >

    • C.

      Both < deny > & < allow >

    • D.

      Neither < deny > nor < allow >

    Correct Answer
    C. Both < deny > & < allow >
    Explanation
    The section in ASP.NET contains both the and elements. These elements are used to specify access control rules for different users or roles. The element is used to deny access to a specific user or role, while the element is used to explicitly allow access to a specific user or role. By using both elements, developers can define fine-grained access control rules for their applications.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 20, 2012
    Quiz Created by
    569461_tcs

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.