Pcs- Programming In C# Test For Aptech

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 Vietha
V
Vietha
Community Contributor
Quizzes Created: 11 | Total Attempts: 9,614
Questions: 65 | Attempts: 1,978

SettingsSettingsSettings
Pcs- Programming In C# Test For Aptech - Quiz

C# is here Variable of reference type store the memory address of other variables in a Stack.


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 given answer correctly identifies that variables of value types store actual values. This means that when a value type variable is assigned a value, the actual value is stored directly in the variable's memory location. This is in contrast to reference types, where variables store a reference to an object in memory rather than the actual value. Additionally, the answer mentions that the value of a value type is stored in a stack, which is the memory area 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 correct answer is False. Variables of reference type store the memory address of other variables in the Heap, not the Stack. In the Stack, only value types and references to objects in the Heap are stored. Reference types themselves are stored in the Heap, and the variables in the Stack hold the memory address of those objects.

    Rate this question:

  • 3. 

    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 because these are both built-in reference data types in programming. Objects are used to represent real-world entities and have properties and methods associated with them. Strings are used to represent sequences of characters and are commonly used for storing and manipulating text. Both Object and String are fundamental data types that are included in most programming languages.

    Rate this question:

  • 4. 

    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 in most programming languages begin with three forward slashes (///). Double slashes (//) are used for single-line comments in some programming languages like C++ and Java, but they are not used for XML comments. Three asterisks (***) are not used for XML comments in any programming language.

    Rate this question:

  • 5. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Constants are declared for value types rather than for reference types because value types store their values directly in memory, while reference types store a reference to the memory location where the actual data is stored. Since constants are immutable and their values cannot be changed, it makes sense to declare them for value types that have their values stored directly. Reference types, on the other hand, can have their values changed by modifying the data at the memory location they reference, so it would not be appropriate to declare constants for them.

    Rate this question:

  • 6. 

    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 ensures that no other process or threads running in the computer memory can interfere with the code. It is used to provide synchronization and ensure thread safety by allowing only one thread to access a specific block of code at a time. The lock statement is typically used with reference types to prevent multiple threads from accessing and modifying the same object simultaneously, which could lead to data corruption or inconsistent results.

    Rate this question:

  • 7. 

    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 and cannot be moved by the garbage collector. This is useful when working with unmanaged code or when you need to ensure that a specific object remains in a fixed memory location during execution. By using the Fixed Statement, you can guarantee that the object will not be moved, providing stability and preventing potential issues that could arise from the object being relocated.

    Rate this question:

  • 8. 

    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 given correct answer states that the conditional && operator does not check the second expression if the first expression is false. This means that if the first expression in a conditional statement using && is false, the second expression will not be evaluated.

    The answer also states that compound assignment operators execute from right to left. This means that if there are multiple compound assignment operators in a statement, they will be executed in reverse order from right to left.

    Both of these statements accurately describe the behavior of the operators mentioned.

    Rate this question:

  • 9. 

    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 example of implicit typecasting.

    Rate this question:

  • 10. 

    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 a class in the System namespace that provides useful methods for converting one built-in data type to another. This class includes methods like ToInt32, ToDouble, ToBoolean, etc., which allow for easy conversion between different data types. The System.Console.Convert option is incorrect because there is no Convert class in the Console namespace.

    Rate this question:

  • 11. 

    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 value type that was previously boxed into its original value type. When a value type is boxed, it is encapsulated within an object on the heap, allowing it to be treated as a reference type. Unboxing, on the other hand, involves extracting the original value type from the boxed object. This is typically done using explicit casting or the unboxing syntax in order to retrieve the original value and use it as a value type again.

    Rate this question:

  • 12. 

    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 in scenarios where a value type needs to be treated as an object, such as when storing it in a collection or passing it as a parameter to a method that expects an object. Boxing helps reduce the overhead on the system during execution by allowing value types to be used in contexts that require reference types.

    Rate this question:

  • 13. 

    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 array as a jagged array. A jagged array is a multi-dimensional array where each sub-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 given array is a jagged array.

    Rate this question:

  • 14. 

    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 in which the elements are arrays themselves. Unlike a multi-dimensional array, a jagged array allows for each row to have a different number of columns. This flexibility in size makes jagged arrays suitable for situations where the number of elements in each row may vary. In terms of performance, jagged arrays can offer improved performance compared to multi-dimensional arrays because they do not require memory allocation for unused elements. Therefore, a jagged array is the most appropriate choice given the requirement of improved performance and unequal number of columns.

    Rate this question:

  • 15. 

    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 correct answer is "Multi-dimensional Array" because the question mentions that the object has many rows and columns. A multi-dimensional array is a data structure that can store values in multiple dimensions, such as rows and columns. It allows for the organization of data in a tabular form with multiple levels of nesting. Therefore, a multi-dimensional array is the most suitable option for an object with many rows and columns.

    Rate this question:

  • 16. 

    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 CreateInstance() method is a method of the Array class. This method allows you to create arrays dynamically at runtime.

    Rate this question:

  • 17. 

    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 type of elements and a specified length. It is a static method that can be accessed without creating an instance of the class. The "elementType" parameter specifies the type of elements in the array, and the "length" parameter specifies the length of the array. This method can be used to create a one-dimensional array by passing a single length parameter, or a multi-dimensional array by passing multiple length parameters.

    Rate this question:

  • 18. 

    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 feature of extracting only the required information from an object and not showing all the technical details. In programming, abstraction allows us to focus on the essential aspects of an object or system, hiding the unnecessary complexity. It helps in simplifying the code and making it more manageable and understandable. By using abstraction, we can create classes, interfaces, and methods that provide a high-level view of the functionality, allowing users to interact with the system without needing to know the underlying implementation details.

    Rate this question:

  • 19. 

    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. This allows for better control over the data and behavior of the class, as well as providing a clear interface for other classes to interact with. By encapsulating the details of a class, we can ensure that the class remains modular and can be easily modified or extended without affecting other parts of the codebase.

    Rate this question:

  • 20. 

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

    • A.

      True

    • B.

      Fasle

    Correct Answer
    B. Fasle
    Explanation
    A method name cannot be an underscore or the "@" character. In most programming languages, method names must follow certain rules and conventions, such as starting with a letter and consisting of letters, numbers, and underscores. The "@" character is often used for special purposes in programming languages, such as denoting attributes or decorators, and cannot be used as part of a method name. Therefore, the statement is false.

    Rate this question:

  • 21. 

    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 that can be accessed without using an object of a class. It belongs to the class itself rather than an instance of the class. This means that all objects of the class share the same static variable, and any changes made to it will be reflected in all instances. Static variables are useful for storing data that is common to all objects of a class, such as a counter or a constant value.

    Rate this question:

  • 22. 

    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 protected access modifier allows class members to be accessible within the class as well as within the derived class. This means that any member marked as protected can be accessed by code within the same class or any subclass that inherits from it. It provides a level of encapsulation by allowing the class and its subclasses to have access to the member, while still restricting access from outside the class hierarchy.

    Rate this question:

  • 23. 

    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 other classes within the same project or assembly, but not by classes outside of the assembly. It provides a level of encapsulation and restricts the visibility of the members to only the classes within the same assembly, enhancing code security and maintainability.

    Rate this question:

  • 24. 

    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 correct answer is "ref, out". In C#, the "ref" keyword is used to pass arguments by reference, allowing the method to modify the value of the argument. Similarly, the "out" keyword is also used to pass arguments by reference, but it is typically used when the method needs to return multiple values. The other choices, "args", "reg", and "this", are not keywords used for passing arguments by reference.

    Rate this question:

  • 25. 

    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 in object-oriented programming languages to refer to the current object. It is used to resolve conflicts between variables that have the same names and to differentiate between instance variables and local variables within a class. Additionally, "this" can be used to pass the current object as a parameter to another method or constructor. This allows for better code readability and avoids ambiguity when working with variables and methods within a class.

    Rate this question:

  • 26. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In Java, the 'this' keyword is used to refer to the current object. However, static variables and methods are not associated with any particular instance of the class, but with the class itself. Therefore, it is not possible to use the 'this' keyword with static variables and methods.

    Rate this question:

  • 27. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A destructor does not start with the character '@' before the class name. In C++, a destructor is a special member function of a class that is automatically called when an object of that class goes out of scope or is deleted. The destructor has the same name as the class, preceded by a tilde (~). Therefore, the given statement is false.

    Rate this question:

  • 28. 

    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
  • 29. 

    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 in C# to access and invoke the members of the base class from within a derived class, but it cannot be used to invoke static methods of the base class. Static methods are accessed using the class name itself, not through an instance or the 'base' keyword.

    Rate this question:

  • 30. 

    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
    In order 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 keyword "virtual". This allows the derived class to provide its own implementation of the method, effectively replacing the implementation in the base class. By using the "virtual" keyword, we ensure that the method can be overridden in the derived class and that the correct implementation is called based on the type of the object at runtime.

    Rate this question:

  • 31. 

    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 keyword "sealed" prevents a class from being inherited by any other class. It is used to restrict the inheritance of a class and ensure that it cannot be extended or subclassed. By marking a class as sealed, it becomes a final class and cannot be further derived. This is useful when you want to prevent other classes from extending or modifying the behavior of a particular class.

    Rate this question:

  • 32. 

    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 fulfill, and any class implementing that interface must provide concrete implementations for all the abstract methods specified 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:

  • 33. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Properties can be classified as variables because they are used to store and retrieve values, just like variables. However, properties differ from regular variables in that they provide a way to control access to the underlying data. The ref and out keywords, on the other hand, are used to pass parameters by reference in method calls, and are not directly related to properties. Therefore, the statement that properties can use the ref and out keywords is incorrect.

    Rate this question:

  • 34. 

    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. These accessors allow us to retrieve and modify the value of a property. Properties provide a way to encapsulate the internal state of an object and provide controlled access to it. They are often used to expose the values of private fields in a class, allowing controlled access and modification of those values. Unlike fields, properties can have logic and validation associated with them, providing more flexibility and control over how the values are accessed and modified.

    Rate this question:

  • 35. 

    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 characteristics of an object, such as its variables or attributes. However, methods represent the behavior or actions that an object can perform. Methods are used to manipulate the object's state, perform calculations, or interact with other objects. Therefore, methods are the correct answer as they define the behavior of an object.

    Rate this question:

  • 36. 

    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 define the state of an object and can be accessed and modified using getter and setter methods. Properties cannot have any parameters, meaning they do not accept arguments. They can be overridden in derived classes to provide a different implementation, but they cannot be overloaded, which means you cannot have multiple properties with the same name but different parameters.

    Rate this question:

  • 37. 

    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 some of the most commonly used namespaces in the System namespace. System.Collections provides classes for working with collections of objects, System.Data is used for accessing and manipulating data from databases, System.Io / System.Net is used for input/output operations and network communications, and System.Diagnostics provides classes for interacting with system processes and performance counters.

    Rate this question:

  • 38. 

    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
    The System.Collections namespace contains classes and interfaces that define complex data structures such as lists, queues, and dictionaries. This namespace provides a variety of collection classes that can be used to store and manipulate groups of objects. These classes include ArrayList, Queue, Stack, Hashtable, and Dictionary. By using the classes and interfaces in the System.Collections namespace, developers can efficiently manage and manipulate collections of data in their applications.

    Rate this question:

  • 39. 

    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 specifically designed for the ADO.NET architecture. ADO.NET is a set of technologies in the .NET framework that allows developers to access and manipulate data from various data sources. The classes in the System.Data namespace provide functionality for connecting to databases, executing queries, and retrieving and updating data. Therefore, System.Data is the most appropriate choice for a namespace that contains classes related to ADO.NET architecture.

    Rate this question:

  • 40. 

    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 System.Diagnostics namespace contains classes that are used to interact with the system processes. This includes classes for starting and stopping processes, monitoring performance counters, and managing event logs. This namespace provides functionality for debugging and profiling applications, as well as retrieving information about running processes and system resources.

    Rate this question:

  • 41. 

    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 correct answer is System.IO because it is the namespace that contains classes for reading from and writing to data streams and files. This namespace provides functionality for working with files, directories, and other input/output operations.

    Rate this question:

  • 42. 

    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. This namespace contains classes that are used to create and manage network connections, send and receive data over the internet, and handle various network protocols. It includes classes for working with HTTP requests and responses, TCP/IP sockets, FTP, SMTP, and more. This namespace is commonly used in web-based applications to handle network communication and data transfer.

    Rate this question:

  • 43. 

    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
    System.Web is the correct answer because it is a namespace in .NET that provides classes and interfaces specifically designed for web development. It includes classes for handling web requests and responses, managing sessions, working with cookies, and other web-related functionalities. This namespace is essential for building web applications and allows communication between the browser and the server. On the other hand, System.Net is primarily used for network programming, and System.Data is focused on database access.

    Rate this question:

  • 44. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
  • 45. 

    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. Properties are a way to encapsulate fields and provide access to them through getter and setter methods. In this declaration, a property named "Property_Name" of type string is being declared. The body of the property can be defined to specify the logic for getting and setting the value of the property.

    Rate this question:

  • 46. 

    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] { //body }". This is the correct declaration to declare an indexer in C#. An indexer allows objects to be indexed like an array, and it is defined using the "this" keyword followed by the type of the object being indexed (in this case, "string") and the parameter type (in this case, "int index"). The body of the indexer contains the logic that is executed when the object is accessed using an index.

    Rate this question:

  • 47. 

    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 syntax for declaring a delegate in C#. The keyword "delegate" is used to declare a delegate type, followed by the return type and the delegate name. The parameters are specified inside the parentheses. In this case, the delegate is named "Delagates_Name" and it takes two integer parameters. The return type is "int".

    Rate this question:

  • 48. 

    Which data structure can not be declared in a namespace ?

    • A.

      Abstract

    • B.

      Interface

    • C.

      Structure

    • D.

      Enumeration

    • E.

      Delegate

    Correct Answer
    A. Abstract
  • 49. 

    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 using namespaces, we can organize our code and avoid naming conflicts between different classes or functions with the same name. Each namespace creates a separate scope, allowing us to define classes with the same name in different namespaces without any conflict. Therefore, namespaces play a crucial role in controlling the scope of a class.

    Rate this question:

  • 50. 

    These Exception are thrown by the CLR.

    • A.

      System-level Exceptions

    • B.

      Application-level Exceptions.

    Correct Answer
    A. System-level Exceptions
    Explanation
    System-level Exceptions are thrown by the CLR (Common Language Runtime) when there is an error at the system level, such as memory access violations or stack overflow. These exceptions are not specific to any particular application and can occur in any .NET application. The CLR handles these exceptions and can terminate the application if necessary. Application-level Exceptions, on the other hand, are specific to a particular application and are thrown when there is an error in the application's code or logic.

    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
  • Feb 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 15, 2009
    Quiz Created by
    Vietha
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.