Quiz On C# Programming Language 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 Danikhan
D
Danikhan
Community Contributor
Quizzes Created: 1 | Total Attempts: 410
Questions: 68 | Attempts: 410

SettingsSettingsSettings
Programming Quizzes & Trivia

C# is here Variable of reference type store the memory address of other variables in a Stack. Take this quiz and learn more about it!


Questions and Answers
  • 1. 

    Variables of this data types store actual values.This value stored in a stack.

    • A.

      Value Type

    • B.

      Reference Type.

    Correct Answer
    A. Value Type
    Explanation
    The explanation for the correct answer is that value types store actual values directly, meaning that the value itself is stored in memory. This is in contrast to reference types, where a reference to the value's location in memory is stored. Value types are typically stored in a stack, which is a region of memory that is used for local variables and function calls.

    Rate this question:

  • 2. 

    Variable of reference type store the memory address of other variables in a Stack.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given statement is false. Variables of reference type do not store the memory address of other variables in a stack. In fact, reference type variables store the memory address of objects in a heap. The stack is used to store value type variables and method calls.

    Rate this question:

  • 3. 

    The Reference Data Types are:- 3 choices

    • A.

      Int,float

    • B.

      String,Object

    • C.

      Class , interface

    • D.

      Byte, bit

    • E.

      Array , Delegate

    Correct Answer(s)
    B. String,Object
    C. Class , interface
    E. Array , Delegate
    Explanation
    The correct answer is String, Object, Class, interface, Array, Delegate. These are all examples of reference data types in programming. Reference data types are used to store references to objects in memory rather than the actual values. String is a reference type used to store a sequence of characters. Object is the base class for all other classes in Java and is used to create instances of other classes. Class and interface are also reference types used to define and create objects. Array is a reference type used to store multiple values of the same type. Delegate is a reference type used to create and invoke methods dynamically.

    Rate this question:

  • 4. 

    The built-in reference data types are : - 2 choices

    • A.

      Class

    • B.

      Object

    • C.

      Delegate

    • D.

      Array , Interface

    • E.

      String

    Correct Answer(s)
    B. Object
    E. String
    Explanation
    The correct answer is Object and String. Object is a built-in reference data type in most programming languages, including Java and C#, that serves as the base class for all other classes. It represents a generic object and can be used to create instances of any class. String is also a built-in reference data type that represents a sequence of characters. It is commonly used to store and manipulate text in programming.

    Rate this question:

  • 5. 

    XML Comments begin with :

    • A.

      Three forward slashes

    • B.

      Three asterisks

    • C.

      Double slashes

    Correct Answer(s)
    A. Three forward slashes
    C. Double slashes
    Explanation
    XML Comments begin with three forward slashes. This is the correct answer because in XML, comments are denoted by the opening tag . The opening tag starts with three forward slashes (///) to indicate that it is a comment. Double slashes (//) are used in other programming languages like JavaScript and C++ to indicate single-line comments, but they are not used in XML comments. Three asterisks (/***) are also not used in XML comments.

    Rate this question:

  • 6. 

    Constants are declared for value types rather than for reference types.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Constants are used to declare values that cannot be changed once they are assigned. In programming, value types are types that hold their values directly, while reference types hold references to objects. Since constants are meant to hold values that do not change, it makes sense to declare them for value types rather than reference types. Therefore, the given statement is true.

    Rate this question:

  • 7. 

    This statement ensure that no other process or threads running in the computer memory can interfere with the code. ensure security and only work with reference type.

    • A.

      Selection statement

    • B.

      Iteration statement

    • C.

      Jump Statement

    • D.

      Fixed Statement

    • E.

      Lock Statement

    Correct Answer
    E. Lock Statement
    Explanation
    The lock statement is used in C# to ensure that no other process or threads running in the computer memory can interfere with the code. It is used to ensure the security and integrity of the code by allowing only one thread to access a particular section of code at a time. This is particularly useful when working with shared resources or critical sections of code that need to be protected from concurrent access. The lock statement can only be used with reference types.

    Rate this question:

  • 8. 

    This statement is required to tell the garbage collector not to move that object during execution.

    • A.

      Jump Statement

    • B.

      Lock statement

    • C.

      Fixed Statement

    • D.

      Check ed and Unchecked Statement

    Correct Answer
    C. Fixed Statement
    Explanation
    The Fixed Statement is used in C# to declare a block of code in which a variable is pinned in memory, preventing the garbage collector from moving it. This is useful when working with unsafe code or when you need to ensure that a specific object remains at a fixed memory location during execution.

    Rate this question:

  • 9. 

    Which statements are true?

    • A.

      The conditional operator works with two operands

    • B.

      The increment operator works with a single operand

    • C.

      The bitwise exclusive OR operator compares bits and return 1 if only one of the bits is -1.

    • D.

      The conditional && operator does not check the seconds expression if the first expression is false

    • E.

      The compound assignment operators execute from right to left.

    Correct Answer(s)
    D. The conditional && operator does not check the seconds expression if the first expression is false
    E. The compound assignment operators execute from right to left.
    Explanation
    The conditional && operator does not check the second expression if the first expression is false because it is a short-circuit operator. If the first expression evaluates to false, the second expression is not evaluated because the overall result will already be false regardless of the second expression. This behavior can be used to improve efficiency in certain situations.

    The compound assignment operators execute from right to left. This means that the right-hand side of the operator is evaluated first, and then the result is assigned to the left-hand side variable. This order of execution is important when using compound assignment operators because it can affect the final value of the variable.

    Rate this question:

  • 10. 

    This typeCasting is carried out automatically by the compiler.

    • A.

      Explicit

    • B.

      Implicit

    Correct Answer
    B. Implicit
    Explanation
    Implicit typecasting refers to the automatic conversion of one data type to another by the compiler without the need for any explicit instructions from the programmer. In this case, the correct answer is "Implicit" because the given statement states that the typecasting is carried out automatically by the compiler, indicating that it is an implicit typecasting.

    Rate this question:

  • 11. 

    The class which provides useful methods to convert any built-in data type to another built-in data type.

    • A.

      System.Console.Convert

    • B.

      System.Convert

    Correct Answer
    B. System.Convert
    Explanation
    System.Convert is the correct answer because it is the class in the System namespace that provides useful methods for converting one built-in data type to another. It offers methods like ToBoolean, ToInt32, ToDouble, etc., which allow for easy and efficient conversion between different data types. System.Console.Convert is not a valid option as there is no Convert class in the Console namespace.

    Rate this question:

  • 12. 

    This refers to converting a reference type to a value type.

    • A.

      Boxing

    • B.

      UnBoxing

    Correct Answer
    B. UnBoxing
    Explanation
    Unboxing refers to the process of converting a boxed value type back to its original value type. When a value type is boxed, it is wrapped inside an object, allowing it to be treated as a reference type. Unboxing is the reverse process where the boxed value is extracted from the object and converted back to its original value type. This allows for the retrieval of the original value and enables operations specific to value types to be performed on it.

    Rate this question:

  • 13. 

    This is a process for converting a value type to its reference type. this useful to reduce the overhead on the system during execution.

    • A.

      UnBoxing

    • B.

      Boxing

    Correct Answer
    B. Boxing
    Explanation
    Boxing is the process of converting a value type to its corresponding reference type. This is useful to reduce the overhead on the system during execution. By boxing a value type, it can be treated as an object and stored on the heap, allowing it to be passed as a parameter to methods that accept objects. This helps in scenarios where value types need to be used in a context that requires reference types, such as collections or interfaces.

    Rate this question:

  • 14. 

    This array is a multi-dimensional array and is reference to as an array of arrays.It considers of multiple arrays where the number of elements within each array can be different.

    • A.

      Rectangular Array.

    • B.

      Jagged Array.

    Correct Answer
    B. Jagged Array.
    Explanation
    The given explanation correctly identifies the concept of a jagged array. A jagged array is a type of multi-dimensional array where each sub-array within the main array can have a different number of elements. This is in contrast to a rectangular array, where all sub-arrays have the same number of elements. Therefore, the correct answer is Jagged Array.

    Rate this question:

  • 15. 

    This has improved performance and unequal number of columns.

    • A.

      Rectangular Array

    • B.

      Single- dimensional Array

    • C.

      Jagged Array

    • D.

      Multi- dimensional Array

    Correct Answer
    C. Jagged Array
    Explanation
    A jagged array is a type of array where each element can be an array of different sizes. This allows for flexibility in storing and accessing data, as each sub-array can have a different number of columns. This can lead to improved performance in certain scenarios, as it allows for more efficient memory usage and reduces the need for resizing or reorganizing the array. Therefore, a jagged array is the most suitable option when dealing with an array that has an unequal number of columns.

    Rate this question:

  • 16. 

    This has many rows and columns.

    • A.

      Multi- dimensional Array

    • B.

      Single- dimensional Array

    • C.

      Rectangular Array

    • D.

      Jagged Array

    Correct Answer
    A. Multi- dimensional Array
    Explanation
    The given statement suggests that the object being referred to has both rows and columns, indicating that it has multiple dimensions. A multi-dimensional array is an array that contains other arrays, allowing for the storage of data in multiple dimensions. This makes it the most suitable option among the given choices.

    Rate this question:

  • 17. 

    This allows you to create arrays using the CreateInstance() method.

    • A.

      Array

    • B.

      New

    • C.

      Array class

    Correct Answer
    C. Array class
    Explanation
    The correct answer is "Array class" because the question states that the CreateInstance() method allows you to create arrays. The CreateInstance() method is a method of the Array class, so selecting "Array class" as the answer is the most appropriate choice.

    Rate this question:

  • 18. 

    Method which is used to create Multi- Dimension Array

    • A.

      Public static Array CreateInstance(type elementType, int length);

    • B.

      Public static Array CreateArray(type elementType, int length);

    • C.

      Public static Array CreateInstance(type elementType, int rows, int columns);

    Correct Answer
    A. Public static Array CreateInstance(type elementType, int length);
    Explanation
    The correct answer is "public static Array CreateInstance(type elementType, int length)". This method is used to create a multi-dimensional array with a specified element type and length. It does not specify the number of dimensions or the shape of the array, only the length of the first dimension. The other two methods, "CreateArray" and "CreateInstance" with two parameters, are not valid options for creating a multi-dimensional array.

    Rate this question:

  • 19. 

    This is the feature of extracting only the required information from object.It's not show all technical details of object.

    • A.

      Encapsulation

    • B.

      Inheritance

    • C.

      Abstraction

    • D.

      Polymorphism

    Correct Answer
    C. Abstraction
    Explanation
    Abstraction is the correct answer because it refers to the concept of hiding unnecessary details and only exposing the essential information. In the context of object-oriented programming, abstraction allows programmers to create classes that represent real-world objects and only expose the necessary properties and methods. This helps to simplify the complexity of the system and makes it easier to understand and use.

    Rate this question:

  • 20. 

    Details of what a class contains need not be visible to other classes and objects that use it.

    • A.

      Encapsulation

    • B.

      Inheritance

    • C.

      Polymorphism

    • D.

      Abstraction

    Correct Answer
    A. Encapsulation
    Explanation
    Encapsulation is the correct answer because it refers to the concept of hiding the internal details and implementation of a class from other classes and objects. It allows for better control and organization of the code, as the class can define its own methods and variables that are only accessible within the class itself. This ensures that the internal workings of a class can be changed without affecting other parts of the program that use it.

    Rate this question:

  • 21. 

    A method name can be an underscore or the "@" character.

    • A.

      True

    • B.

      Fasle

    Correct Answer
    B. Fasle
  • 22. 

    This variable is a special type that is accessed without using an Object of a class.

    • A.

      Public variable

    • B.

      Protect variable

    • C.

      Static variable

    • D.

      Final

    Correct Answer
    C. Static variable
    Explanation
    A static variable is a special type of variable that can be accessed without using an object of a class. It belongs to the class itself rather than a specific instance of the class. This means that all instances of the class share the same value of the static variable. It can be accessed directly using the class name followed by the variable name.

    Rate this question:

  • 23. 

    This acces modifier allows the class members to be accessible within the class as well as within the derived class.

    • A.

      Internal

    • B.

      Protected

    • C.

      Private

    Correct Answer
    B. Protected
    Explanation
    The access modifier "protected" allows the class members to be accessible within the class as well as within the derived class. This means that any member with the "protected" access modifier can be accessed by any class that inherits from the current class, in addition to being accessible within the class itself. This provides a level of encapsulation and allows for better code organization and reuse.

    Rate this question:

  • 24. 

    This access modifier allows the class members to be accessible only within the classes of the same assembly.

    • A.

      Protected

    • B.

      Public

    • C.

      Internal

    Correct Answer
    C. Internal
    Explanation
    The access modifier "internal" allows the class members to be accessible only within the classes of the same assembly. This means that the members can be accessed by any code within the same assembly, but not by code outside of the assembly. This provides a level of encapsulation and restricts the visibility of the members to only the classes within the same assembly, ensuring that they are not accessed or modified by external code.

    Rate this question:

  • 25. 

    This keyword causes arguments to passed in a method by reference.- 2 choices

    • A.

      Args

    • B.

      Ref

    • C.

      Reg

    • D.

      This

    • E.

      Out

    Correct Answer(s)
    B. Ref
    E. Out
    Explanation
    The keyword "ref" is used in C# to pass arguments to a method by reference. When a parameter is passed by reference, any changes made to the parameter inside the method will affect the original variable outside the method as well. The "out" keyword is also used to pass arguments by reference, but it is typically used when a method needs to return multiple values. Both "ref" and "out" allow for two-way communication between the calling method and the called method.

    Rate this question:

  • 26. 

    The keyword is used to resolve conflicts between variables having same names and to pass the current object as a parameter.

    • A.

      Out

    • B.

      This

    • C.

      Ref

    Correct Answer
    B. This
    Explanation
    The keyword "this" is used to refer to the current object in a class. It is used to resolve conflicts between variables that have the same name and to differentiate between instance variables and local variables. It can also be used to pass the current object as a parameter to another method or constructor.

    Rate this question:

  • 27. 

    You cannot use the 'this' keyword with static variables and method.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The statement is true because the 'this' keyword is used to refer to the current object instance in a non-static context. Static variables and methods belong to the class itself rather than any specific object instance, so using 'this' with them would be invalid.

    Rate this question:

  • 28. 

    A destructor start with the character '@' before the class name.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A destructor in C++ is a special member function of a class that is called automatically when an object of that class is destroyed. It is used to release any resources or memory allocated by the object. In C++, a destructor is defined using the tilde (~) symbol followed by the class name, not with the character '@' before the class name. Therefore, the given statement is false.

    Rate this question:

  • 29. 

    Which statements are true?- 3 choices

    • A.

      Destructors cannot be overloaded or inherited

    • B.

      Destructors can be overloaded but not be inherited

    • C.

      Destructors cannot be i explicitly invoked

    • D.

      Destructors cannot specify access modifiers and take parameters

    • E.

      May be more than two Destructor in a class

    Correct Answer(s)
    A. Destructors cannot be overloaded or inherited
    C. Destructors cannot be i explicitly invoked
    D. Destructors cannot specify access modifiers and take parameters
  • 30. 

    You can use the 'base' keyword for invoking the static methods of the base class.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The statement is false because the 'base' keyword is used to access and invoke the members of the base class from within the derived class. It cannot be used to invoke static methods of the base class. To invoke static methods of the base class, the class name itself should be used.

    Rate this question:

  • 31. 

    So as to override  a particular method of base class in the derived class, we need to declare the method of base class using the keyword.

    • A.

      Override

    • B.

      Virtual

    Correct Answer
    B. Virtual
    Explanation
    To override a particular method of the base class in the derived class, we need to declare the method of the base class using the "virtual" keyword. This allows the derived class to provide its own implementation of the method, which will be used instead of the base class implementation when the method is called on an object of the derived class. The "override" keyword is then used in the derived class to indicate that the method is intended to override a virtual method from the base class.

    Rate this question:

  • 32. 

    This keyword prevents a class from being inherited by any other class.

    • A.

      Seales

    • B.

      Sealed

    • C.

      Prevents

    • D.

      Out

    • E.

      Virtual

    Correct Answer
    B. Sealed
    Explanation
    The correct answer is "Sealed." The keyword "sealed" is used to prevent a class from being inherited by any other class. When a class is marked as "sealed," it cannot be used as a base class for any other class, effectively blocking inheritance. This is useful in scenarios where the design requires a class to be finalized and not extended further.

    Rate this question:

  • 33. 

    When implementing an interface in a class, you need to implement all the abstract  methods declared in the interface.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    When implementing an interface in a class, it is necessary to implement all the abstract methods declared in the interface. This is because an interface defines a contract that a class must adhere to, and implementing all the abstract methods ensures that the class provides the necessary functionality required by the interface. Failure to implement any of the abstract methods will result in a compilation error. Therefore, the correct answer is true.

    Rate this question:

  • 34. 

    Properties cannot be classified as variables but, They can use the ref and out keywords.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The statement is incorrect. Properties can be classified as variables as they are a way to encapsulate data and provide access to it. However, properties cannot use the ref and out keywords, as those keywords are used with parameters in methods to pass them by reference.

    Rate this question:

  • 35. 

    These  are defined with two accessors or methods, the get and set accessors.

    • A.

      Properties

    • B.

      Fields

    Correct Answer
    A. Properties
    Explanation
    Properties are defined with two accessors or methods, the get and set accessors. This allows us to encapsulate the internal state of an object and control how it is accessed and modified. Properties provide a way to read and write values to an object, while also allowing us to add logic or validation to the accessors if needed. Fields, on the other hand, are variables that are directly accessible within a class and do not have any associated accessors. Therefore, the correct answer is properties.

    Rate this question:

  • 36. 

    These represent the behavior of an Object.

    • A.

      Fields

    • B.

      Properties

    • C.

      Methods

    Correct Answer
    C. Methods
    Explanation
    Fields and properties represent the state or attributes of an object, such as its variables or data. On the other hand, methods represent the behavior or actions that an object can perform. Methods encapsulate the logic and functionality of an object, allowing it to interact with other objects and manipulate its own state. Therefore, methods are the correct answer as they define the behavior of an object.

    Rate this question:

  • 37. 

    These represent characteristic of an Object. Can not have any parameters. and can be overidden but cannot be Overload.

    • A.

      Properties

    • B.

      Methods.

    • C.

      Fields

    Correct Answer
    A. Properties
    Explanation
    Properties in object-oriented programming represent the characteristics or attributes of an object. They are used to encapsulate data and provide a way to access and modify it. Unlike methods, properties do not have any parameters and are typically used to get or set the value of a specific attribute. Properties can be overridden in derived classes to provide a different implementation, but they cannot be overloaded, meaning that multiple properties with the same name but different parameters cannot exist.

    Rate this question:

  • 38. 

    Some of most Namespaces of System are:- 4 choices

    • A.

      System.Collections.

    • B.

      System.Data

    • C.

      System.namespaces

    • D.

      System.Io / System.Net

    • E.

      System.Diagnostics

    Correct Answer(s)
    A. System.Collections.
    B. System.Data
    D. System.Io / System.Net
    E. System.Diagnostics
    Explanation
    The correct answer is System.Collections., System.Data, System.Io / System.Net, System.Diagnostics. These are the most commonly used namespaces in the System namespace. System.Collections provides classes for working with collections of objects, System.Data provides classes for working with data in a database, System.Io / System.Net provides classes for input/output operations and network communication, and System.Diagnostics provides classes for interacting with system processes and performance counters.

    Rate this question:

  • 39. 

    Thsi namespace contains classes and interfaces that define conplex data structure as lists,queues..and dictionaries.

    • A.

      System.Diagnostics

    • B.

      System.Io / System.Net

    • C.

      System.Data

    • D.

      System.Collections.

    • E.

      System.Web

    Correct Answer
    D. System.Collections.
    Explanation
    System.Collections is the correct answer because it is the namespace that contains classes and interfaces for defining complex data structures like lists, queues, and dictionaries. The other namespaces listed (System.Diagnostics, System.Io/System.Net, System.Data, and System.Web) do not specifically deal with data structures, but rather focus on other aspects of programming such as diagnostics, input/output, networking, database access, and web development.

    Rate this question:

  • 40. 

    This namespace contains classes that make up ADO.NET architecture.

    • A.

      System.Web

    • B.

      System.Collections.

    • C.

      System.Diagnostics

    • D.

      System.Io / System.Net

    • E.

      System.Data

    Correct Answer
    E. System.Data
    Explanation
    The correct answer is System.Data because this namespace contains classes that are used in ADO.NET architecture. ADO.NET is a data access technology that allows developers to interact with databases and other data sources. The classes in the System.Data namespace provide functionality for connecting to databases, executing queries, and retrieving and manipulating data. Therefore, System.Data is the correct answer as it is directly related to ADO.NET.

    Rate this question:

  • 41. 

    This namespace contains classes that are used to interact with the system processes.

    • A.

      System.Data

    • B.

      System.Diagnostics

    • C.

      System.Io / System.Net

    • D.

      System.Web

    Correct Answer
    B. System.Diagnostics
    Explanation
    The correct answer is System.Diagnostics. The System.Diagnostics namespace contains classes that are used to interact with the system processes. This includes classes for starting, stopping, and monitoring processes, as well as classes for accessing and manipulating performance counters and event logs. It provides functionality to debug and trace applications, manage processes and threads, and handle system events.

    Rate this question:

  • 42. 

    This namespace contains classes that enable you to read from and write to data stream and file.

    • A.

      System.Diagnostics

    • B.

      System.Web

    • C.

      System.IO

    • D.

      System.Net

    Correct Answer
    C. System.IO
    Explanation
    The System.IO namespace contains classes that enable you to read from and write to data stream and file. It provides classes like StreamReader and StreamWriter that allow reading and writing text from and to files, and BinaryReader and BinaryWriter that allow reading and writing binary data from and to files. This namespace is commonly used for file input/output operations in .NET applications.

    Rate this question:

  • 43. 

    This namespace contains classes that you yo create Web-base applications.

    • A.

      System.Net

    • B.

      System.Web

    • C.

      System.Diagnostics

    Correct Answer
    A. System.Net
    Explanation
    The correct answer is System.Net because this namespace contains classes that are used to create web-based applications. It provides classes for handling network communication, such as sending and receiving data over HTTP, FTP, and other protocols. Therefore, System.Net is the appropriate choice for developing web-based applications.

    Rate this question:

  • 44. 

    This namespace provides classes and interfaces that allow communication between the browser and the serevr.

    • A.

      System.Net

    • B.

      System.Web

    • C.

      System.Data

    Correct Answer
    B. System.Web
    Explanation
    The System.Web namespace provides classes and interfaces that allow communication between the browser and the server. This includes handling HTTP requests and responses, managing sessions and application state, and providing server-side functionality for web applications.

    Rate this question:

  • 45. 

    You can apply access modifier such as public, protected, private .. to namspaces

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Access modifiers such as public, protected, and private cannot be applied to namespaces in most programming languages. Namespaces are typically used to organize and group related code elements, and they do not have the same visibility and access control as classes or other code elements. Therefore, the statement is false.

    Rate this question:

  • 46. 

    Which declaration is used to declare a property.

    • A.

      Public string property_Name(int parameter) { // body }

    • B.

      Public string Property_Name { //body. }

    • C.

      Public string this[int Property_name] { // body }

    • D.

      Public delegate Property_Name(typeData parameter1, typeData parameter2);

    • E.

      Public string property_Name() { //body }

    Correct Answer
    B. Public string Property_Name { //body. }
    Explanation
    The correct answer is "public string Property_Name". This is the correct declaration to declare a property.

    Rate this question:

  • 47. 

    Which declaration is used to declare a indexer.

    • A.

      Public string [int index]() { //body }

    • B.

      Public string int[int index] { //body }

    • C.

      Public string this[int index]() { //body }

    • D.

      Public string this[int index] { //body }

    Correct Answer
    D. Public string this[int index] { //body }
    Explanation
    The correct answer is "public string this[int index]". This is the correct declaration used to declare an indexer in C#. An indexer allows instances of a class or struct to be indexed just like an array, allowing you to access elements using square brackets. The declaration includes the keyword "this" followed by the type of the return value, the parameter list in square brackets, and the body of the indexer.

    Rate this question:

  • 48. 

    Which declaration is used to declare a delegate.

    • A.

      Public delegates Delagate_Name(int parameter1,int parameter2){}

    • B.

      Public delegates Delagates_Name(int parameter1,int parameter2);

    • C.

      Public delegate int Delagates_Name(int parameter1,int parameter2);

    • D.

      Public delegate float Delagate_Name(int parameter1,int parameter2){}

    Correct Answer
    C. Public delegate int Delagates_Name(int parameter1,int parameter2);
    Explanation
    The correct answer is "public delegate int Delagates_Name(int parameter1, int parameter2);". This is the correct declaration for declaring a delegate. The "delegate" keyword is used to declare a delegate, followed by the return type and the delegate name. In this case, the delegate name is "Delagates_Name" and it takes two parameters of type int. The return type is int.

    Rate this question:

  • 49. 

    Which data structure can not be declared in a namespace ?

    • A.

      Abstract

    • B.

      Interface

    • C.

      Structure

    • D.

      Enumeration

    • E.

      Delegate

    Correct Answer
    A. Abstract
  • 50. 

    Namespaces control scopes of a class.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    This statement is true because namespaces in programming languages like C++ and C# are used to control the scope of classes, functions, and variables. By organizing code into different namespaces, developers can avoid naming conflicts and make their code more modular and maintainable. Namespaces provide a way to group related classes together and provide a hierarchical structure to the code. They help in organizing large codebases and make it easier to understand and navigate the code.

    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 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 11, 2012
    Quiz Created by
    Danikhan
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.