1.
Variables of this data types store actual values.This value stored in a stack.
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.
2.
Variable of reference type store the memory address of other variables in a Stack.
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.
3.
The Reference Data Types are:- 3 choices
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.
4.
The built-in reference data types are : - 2 choices
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.
5.
XML Comments begin with :
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.
6.
Constants are declared for value types rather than for reference types.
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.
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.
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.
8.
This statement is required to tell the garbage collector not to move that object during execution.
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.
9.
Which statements are true?
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.
10.
This typeCasting is carried out automatically by the compiler.
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.
11.
The class which provides useful methods to convert any built-in data type to another built-in data type.
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.
12.
This refers to converting a reference type to a value type.
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.
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.
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.
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.
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.
15.
This has improved performance and unequal number of columns.
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.
16.
This has many rows and columns.
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.
17.
This allows you to create arrays using the CreateInstance() method.
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.
18.
Method which is used to create Multi- Dimension Array
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.
19.
This is the feature of extracting only the required information from object.It's not show all technical details of object.
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.
20.
Details of what a class contains need not be visible to other classes and objects that use it.
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.
21.
A method name can be an underscore or the "@" character.
Correct Answer
B. Fasle
22.
This variable is a special type that is accessed without using an Object of a class.
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.
23.
This acces modifier allows the class members to be accessible within the class as well as within the derived class.
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.
24.
This access modifier allows the class members to be accessible only within the classes of the same assembly.
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.
25.
This keyword causes arguments to passed in a method by reference.- 2 choices
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.
26.
The keyword is used to resolve conflicts between variables having same names and to pass the current object as a parameter.
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.
27.
You cannot use the 'this' keyword with static variables and method.
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.
28.
A destructor start with the character '@' before the class name.
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.
29.
Which statements are true?- 3 choices
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.
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.
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.
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.
32.
This keyword prevents a class from being inherited by any other class.
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.
33.
When implementing an interface in a class, you need to implement all the abstract methods declared in the interface.
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.
34.
Properties cannot be classified as variables but, They can use the ref and out keywords.
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.
35.
These are defined with two accessors or methods, the get and set accessors.
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.
36.
These represent the behavior of an Object.
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.
37.
These represent characteristic of an Object. Can not have any parameters. and can be overidden but cannot be Overload.
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.
38.
Some of most Namespaces of System are:- 4 choices
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.
39.
Thsi namespace contains classes and interfaces that define conplex data structure as lists,queues..and dictionaries.
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.
40.
This namespace contains classes that make up ADO.NET architecture.
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.
41.
This namespace contains classes that are used to interact with the system processes.
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.
42.
This namespace contains classes that enable you to read from and write to data stream and file.
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.
43.
This namespace contains classes that you yo create Web-base applications.
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.
44.
This namespace provides classes and interfaces that allow communication between the browser and the serevr.
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.
45.
You can apply access modifier such as public, protected, private .. to namspaces
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.
46.
Which declaration is used to declare a property.
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.
47.
Which declaration is used to declare a indexer.
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.
48.
Which declaration is used to declare a delegate.
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.
49.
Which data structure can not be declared in a namespace ?
Correct Answer
A. Abstract
50.
Namespaces control scopes of a class.
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.