1.
1. If “real” data type is used in Database, whats the equivalent datatype in C#-
Correct Answer
B. Single
Explanation
The equivalent data type in C# for the "real" data type used in a database is "Single".
2.
1. String a= “100”; int b = 10; ___________ What should be written to get the out put as 110?
Correct Answer
C. C.Int c = Convert.ToInt32(a) + b;
Explanation
To get the output as 110, the string variable "a" needs to be converted to an integer. This can be done using the Convert.ToInt32() method. Then, the integer variable "b" can be added to the converted integer value of "a" and stored in the integer variable "c". Therefore, the correct answer is c.Int c = Convert.ToInt32(a) + b.
3.
1. Array is a abstract class. So It cannot have constructor---
Correct Answer
A. A.True
Explanation
The statement is true because an abstract class cannot be instantiated, meaning that objects of an abstract class cannot be created. Since a constructor is used to create objects, it is not allowed in an abstract class. Therefore, the given statement correctly states that an array, being an abstract class, cannot have a constructor.
4.
1. Can an Interface be instantiated directly?
Correct Answer
B. B.No
Explanation
An interface cannot be instantiated directly because it is an abstract type that only defines the structure and behavior of a class. It cannot be used to create objects on its own. Instead, it is implemented by classes, which provide the necessary functionality. Therefore, the correct answer is "No."
5.
1. What is the Difference between Convert.ToInt32 and Int.Parse?
Correct Answer
B. B.Int.Parse Can't Handle Null values , It will throws ArgumentNull Exception Error.
Explanation
Int.Parse and Convert.ToInt32 are both methods used to convert a string to an integer in C#. However, there is a difference between the two. Int.Parse cannot handle null values and will throw an ArgumentNullException error if it encounters a null value. On the other hand, Convert.ToInt32 can handle null values and will not throw an error in such cases. Therefore, the correct answer is b.Int.Parse Can't Handle Null values, It will throw an ArgumentNullException error.
6.
1. What is the difference between Convert.ToString(str) and str.ToString() method?
Correct Answer
A. A.Convert.ToString(str) function handles NULL while str.ToString() does not. It will throw a NULL reference exception.
Explanation
The correct answer is a. Convert.ToString(str) function handles NULL while str.ToString() does not. It will throw a NULL reference exception. This means that if the variable "str" is null, using Convert.ToString(str) will return an empty string instead of throwing an exception, while using str.ToString() will throw a NULL reference exception.
7.
1. Which of the following statements are correct about the Bitwise & operator used in C#.NET?
Correct Answer(s)
C. The & operator can be used to put OFF a bit.
D. The & operator can be used to check whether a bit is ON.
E. The & operator can be used to check whether a bit is OFF.
Explanation
The bitwise & operator in C#.NET can be used to put OFF a bit by performing a bitwise AND operation between two numbers, where the result will have the corresponding bit turned off if both bits are turned on. Additionally, the & operator can be used to check whether a bit is ON by performing a bitwise AND operation between the number and a mask where the bit of interest is turned on. If the result is not zero, it means the bit is ON. Similarly, the & operator can also be used to check whether a bit is OFF by performing a bitwise AND operation between the number and a mask where the bit of interest is turned off. If the result is zero, it means the bit is OFF.
8.
1. Which of the following statements are correct?
Correct Answer
A. The conditional operator (?:) returns one of two values depending on the value of a Boolean expression.
Explanation
The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. This operator is commonly used as a shorthand for an if-else statement. It evaluates the Boolean expression and if it is true, it returns the value before the colon (:), otherwise it returns the value after the colon. This allows for concise and efficient code when making decisions based on a condition.
9.
1. Which of the following is an 8-byte Integer?
Correct Answer
B. Long
Explanation
The correct answer is "Long" because a Long data type in Java is an 8-byte integer. It can store values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Other options such as Char, Short, Byte, and Integer have smaller storage sizes and cannot hold values as large as an 8-byte integer.
10.
1. What is the size of a Decimal?
Correct Answer
C. 16 byte
Explanation
The size of a Decimal is 16 bytes. This data type is used to store decimal numbers with high precision and is commonly used in financial and monetary calculations. The 16-byte size allows for a larger range of values and more precise calculations compared to other numeric data types.
11.
1. Which of the following statements are correct? (Choose 2)
Correct Answer(s)
A. We can assign values of any type to variables of type object.
E. When a value type is boxed, an entirely new object must be allocated and constructed.
Explanation
The correct answer is that we can assign values of any type to variables of type object and when a value type is boxed, an entirely new object must be allocated and constructed. This means that objects of any type can be stored in variables of type object, and when a value type is converted to object, it is boxed and a new object is created to hold the value.
12.
1. Which of the following statements are correct about data types? (Choose 3)
Correct Answer(s)
A. Each value type has an implicit default constructor that initializes the default value of that type.
C. All value types are derived implicitly from System.ValueType class.
E. Variables of reference types referred to as objects and store references to the actual data.
Explanation
The first statement is correct because each value type in C# has an implicit default constructor that initializes the default value of that type. The second statement is incorrect because value types cannot contain the null value, only reference types can. The third statement is correct because all value types in C# are derived implicitly from the System.ValueType class. The fourth statement is incorrect because in C#, local variables must be initialized before being used. The fifth statement is correct because variables of reference types are referred to as objects and they store references to the actual data.
13.
1. Which of the following statements are TRUE about the .NET CLR?
(Choose which ever is correct)
Correct Answer(s)
A. It provides a language-neutral development & execution environment.
B. It ensures that an application would not be able to access memory that it is not authorized to access.
C. It provides services to run "managed" applications
D. The resources are garbage collected.
Explanation
The correct answer is that the .NET CLR provides a language-neutral development & execution environment, ensures that an application would not be able to access memory that it is not authorized to access, provides services to run "managed" applications, and the resources are garbage collected. This means that the CLR allows developers to write code in multiple languages, enforces memory access restrictions, supports running applications that are managed by the CLR, and automatically frees up memory by garbage collecting unused resources.
14.
1. Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?
Correct Answer
A. .NET class libraries
Explanation
The .NET class libraries provide an extensible set of classes that can be used by any .NET compliant programming language. These libraries contain pre-built code that developers can use to perform common tasks, such as file input/output, database access, and networking. By using the .NET class libraries, developers can save time and effort by leveraging existing code rather than writing everything from scratch. Additionally, the .NET class libraries are designed to be language-agnostic, meaning that they can be used with any programming language that is compatible with the .NET framework.
15.
1. Which of the following jobs are done by Common Language Runtime?
Correct Answer
E. All the above
Explanation
The Common Language Runtime (CLR) is responsible for providing core services such as memory management, thread management, and remoting. It also enforces strict type safety to ensure that code is executed securely. Additionally, the CLR provides Code Access Security to protect against unauthorized access to system resources. Lastly, it provides Garbage Collection Services to automatically manage memory and deallocate objects that are no longer in use. Therefore, all of the given options are jobs done by the Common Language Runtime.
16.
1. Which of the following statements are correct about functions used in C#.NET? (Choose 3)
Correct Answer(s)
A. Function definitions cannot be nested.
B. Functions can be called recursively.
E. Function calls can be nested.
Explanation
The first statement is correct because function definitions cannot be nested in C#.NET. This means that you cannot define a function inside another function.
The second statement is correct because functions can be called recursively in C#.NET. This means that a function can call itself during its execution.
The fifth statement is correct because function calls can be nested in C#.NET. This means that a function can be called from within another function, creating a nested call structure.
17.
1. How many values is a function capable of returning?
Correct Answer
A. 1
Explanation
A function is capable of returning only one value.
18.
1. Which of the following statements are correct?
Correct Answer(s)
A. Instance members of a class can be accessed only through an object of that class.
C. All objects created from a class will occupy equal number of bytes in memory.
E. A class is a blueprint or a template according to which objects are created.
Explanation
The first statement is correct because instance members of a class can only be accessed through an object of that class. The second statement is incorrect because a class can also contain static data and static member functions. The third statement is incorrect because objects created from a class can occupy different number of bytes in memory depending on their data members and the compiler's implementation. The fourth statement is correct because a class can contain Friend functions. The fifth statement is correct because a class is indeed a blueprint or template according to which objects are created.
19.
1. Which of the following is the incorrect form of Decision Control instruction?
Correct Answer
C. If (Condition1) {// Some statement}
else {// Some statement}
else if ( Condition2){//Some statement}
Explanation
The given code snippet is the incorrect form of a decision control instruction because it contains two "else" statements consecutively. In a valid decision control structure, there can only be one "else" statement following an "if" statement. The correct form would be to use "else if" for subsequent conditions.
20.
1. Which of the following statements are correct about the C#.NET code snippet given below? (Choose 3)
if (age > 18 && no < 11)
a = 25;
Correct Answer(s)
A. The condition no < 11 will be evaluated only if age > 18 evaluates to True.
D. The statement a = 25 will get executed if both the conditions are True.
E. && is known as a short circuiting logical operator.
Explanation
The given code snippet contains an if statement with two conditions, age > 18 and no < 11. The first correct statement explains that the condition no < 11 will only be evaluated if age > 18 is true. This is because the && operator is a short-circuiting logical operator, which means that if the first condition is false, the second condition will not be evaluated. The second correct statement states that the statement a = 25 will be executed if both conditions are true. Therefore, if age is greater than 18 and no is less than 11, the statement a = 25 will be executed.
21.
1. Which of the following can be facilitated by the Inheritance mechanism? (Choose 3)
Correct Answer(s)
A. Use the existing functionality of base class.
B. Overrride the existing functionality of base class.
C. Implement new functionality in the derived class.
Explanation
The Inheritance mechanism allows for the use of existing functionality of a base class, which means that the derived class can inherit and utilize the methods and attributes of the base class. It also allows for the override of existing functionality of the base class, meaning that the derived class can modify or replace the methods or attributes inherited from the base class. Additionally, the Inheritance mechanism enables the implementation of new functionality in the derived class, allowing for the addition of new methods or attributes specific to the derived class.
22.
1. In an inheritance chain which of the following members of base class are accessible to the derived class members? (Chhose 2)
Correct Answer(s)
B. Protected
E. Public
Explanation
In an inheritance chain, the protected members of the base class are accessible to the derived class members. Protected members can be accessed by the derived class as if they were its own members. Additionally, the public members of the base class are also accessible to the derived class members. Public members can be accessed by any class, including the derived class.
23.
1. Which of the following will be the correct output for the C#.NET code snippet given below?
String s1 = "ALL MEN ARE CREATED EQUAL";
String s2;
s2 = s1.Substring(12, 3);
Console.WriteLine(s2);
Correct Answer
B. CRE
Explanation
The code snippet is using the Substring method in C#.NET to extract a portion of the string "ALL MEN ARE CREATED EQUAL". The method takes two parameters: the starting index and the length of the substring to be extracted. In this case, the starting index is 12 and the length is 3. So, the substring that will be extracted is "CRE". Therefore, the correct output for the code snippet is "CRE".
24.
1. Which of the following statements will correctly copy the contents of one string into another ?
Correct Answer
C. String s1 = "String";
String s2;
s2 = String.Copy(s1);
Explanation
The correct answer is "String s1 = "String"; String s2; s2 = String.Copy(s1);" because it uses the String.Copy() method to copy the contents of one string into another. This method creates a new string object with the same value as the original string.
25.
1. which of the following statements are true about finally block? (Choose 3)
Correct Answer(s)
A. Finally block is executed even if an error occurs
B. Finally block is definitely executed when leaving a try block.
C. Finally block is used to perform any necessary clean-up jobs.
Explanation
The finally block is executed even if an error occurs, ensuring that any necessary clean-up jobs are performed. It is also definitely executed when leaving a try block, regardless of whether an error occurred or not.
26.
1. System Exceptions are handled by
Correct Answer
B. CLR
Explanation
System Exceptions are handled by CLR (Common Language Runtime). CLR is the runtime environment provided by the .NET framework that manages the execution of .NET programs. It is responsible for various tasks such as memory management, security, exception handling, and garbage collection. When a system exception occurs in a .NET program, CLR takes control and handles the exception by either terminating the program or providing appropriate error handling mechanisms. CLR ensures that the program's execution is managed in a safe and controlled manner, making it the correct answer for this question.
27.
1. Is it possible to store multiple datatypes in System.Array
Correct Answer
B. ImPossible
Explanation
It is not possible to store multiple datatypes in System.Array. System.Array is a fixed-size collection that can only store elements of a single datatype. If we need to store multiple datatypes, we can use System.Collections.ArrayList which allows storing elements of different datatypes.
28.
1. Int I =0;
For(;i<10;)
{//loop 1
I++;
For(;i>9;i--)
{
//loop2
}
}
How many times loop gets executed?
Correct Answer
A. Infinite
Explanation
The loop will execute infinitely because the condition for the first loop (i < 10) will always be true since i is initialized as 0 and incremented within the loop. Therefore, the loop will never terminate and continue executing indefinitely.
29.
1. Statement 1: Console.ReadLine(“---”);
Statement 2: Console.In.Readline(“---”);
Both are same.
Correct Answer
A. True
Explanation
Statement 1 and Statement 2 are not the same.
In Statement 1, the correct syntax is `Console.ReadLine("text");` where "text" is the prompt that will be displayed to the user. This method reads the input from the user as a string.
In Statement 2, `Console.In.Readline("text");` is not a valid syntax. The correct syntax is `Console.ReadLine();` without any arguments. This method also reads the input from the user as a string.
Therefore, the correct answer is False, as Statement 1 and Statement 2 are not the same.
30.
1. Array is a abstract class. So It cannot have constructor---
Correct Answer
A. True
Explanation
The statement is true because an abstract class cannot be instantiated, which means it cannot have a constructor. Abstract classes are meant to be extended by other classes, and their constructors are called when an instance of a subclass is created. Therefore, an abstract class itself does not need a constructor.
31.
1. Which of the following statements is correct about the C#.NET code snippet given below?
int a = 10;
int b = 20;
int c = 30;
enum color: byte
{
red = a,
green = b,
blue = c
}
Correct Answer
A. Variables cannot be assigned to enum elements.
Explanation
The given code snippet is defining an enum named "color" with three elements: red, green, and blue. The values of these elements are assigned using variables a, b, and c, which is not allowed in C#. Enum elements must have constant values, so variables cannot be assigned to enum elements.
32.
1. Which of the following can be declared in an interface? (Choose 3)
Correct Answer(s)
A. Properties
B. Methods
D. Events
Explanation
In an interface, you can declare properties, methods, and events. An interface is a contract that defines a set of members that a class must implement. Properties allow you to define the characteristics or attributes of an object. Methods define the behavior or actions that an object can perform. Events allow objects to communicate with each other by sending and receiving notifications. Enumerations, structures, and other types of members cannot be declared in an interface.
33.
1. What are the types of parameters?
Correct Answer
E. All the above
Explanation
The correct answer is "All the above" because all the mentioned options (out, ref, params, value) are types of parameters in programming. "out" parameters are used to pass data out of a method, "ref" parameters are used to pass data by reference, "params" parameters allow a variable number of arguments to be passed to a method, and "value" parameters are used to pass data by value. Therefore, all of these options are valid types of parameters.
34.
1. Write the keyword which can be used to declare parameter arrays?
Correct Answer
A. Params
Explanation
The keyword "Params" can be used to declare parameter arrays.
35.
1. Which one of the modifiers declare a method to be class method?
Correct Answer
C. Static
Explanation
The correct answer is "static". In Java, the "static" modifier is used to declare a method as a class method. Class methods are associated with the class itself rather than with any specific instance of the class. They can be called directly on the class without creating an object of the class.