πŸ“Š C#
Q. Which of the following is the correct size of a Decimal datatype?
  • (A) 8 bytes
  • (B) 4 bytes
  • (C) 10 bytes
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) None of the above
πŸ“Š C#
Q. Which of the following statements are correct?
1. We can assign values of any type to variables of type object.
2. When a variable of a value type is converted to object, it is said to be unboxed.
3. When a variable of type object is converted to a value type, it is said to be boxed.
4. Boolean variable cannot have a value of null.
5. When a value type is boxed, an entirely new object must be allocated and constructed.
  • (A) 2,5
  • (B) 1,5
  • (C) 3,4
  • (D) 2,3
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1,5
πŸ“Š C#
Q. Which of the following is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified?
  • (A) float pi = 3.14F;
  • (B) #define pi 3.14F;
  • (C) const float pi = 3.14F;
  • (D) const float pi; pi = 3.14F;
πŸ’¬ Discuss
βœ… Correct Answer: (C) const float pi = 3.14F;
πŸ“Š C#
Q. Which of the following can be used to terminate a while loop and transfer control outside the loop?
1. exit while
2. continue
3. exit statement
4. break
5. goto
  • (A) 1,3
  • (B) 2,4
  • (C) 3,5
  • (D) 4,5
πŸ’¬ Discuss
βœ… Correct Answer: (D) 4,5
πŸ“Š C#
Q. Which of the following statements are correct about the C#.NET code snippet given below?
if (age > 18 && no < 11) a = 25;
1. The condition no <11 will be evaluated only if age > 18 evaluates to True.
2. The statement a =25 will get executed if any one condition is True.
3. The condition no < 11will be evaluated only if age > 18 evaluates to False.
4. The statement a = 25 will get executed if both the conditions are True.
5. && is known as a short circuiting logical operator.
  • (A) 1,3
  • (B) 2,5
  • (C) 1,4,5,
  • (D) 3,4,5
πŸ’¬ Discuss
βœ… Correct Answer: (C) 1,4,5,
πŸ“Š C#
Q. Which of the following is the correct output for the C#.NET code snippet
given below?
Code:
Console.WriteLine(13 / 2 + " " + 13 % 2);
  • (A) 6.5 1
  • (B) 6.5 0
  • (C) 6 0
  • (D) 6 1
πŸ’¬ Discuss
βœ… Correct Answer: (D) 6 1
πŸ“Š C#
Q. Which of the following statements are correct?
1. Instance members of a class can be accessed only through an object of that class.
2. A class can contain only instance data and instance member function.
3. All objects created from a class will occupy equal number of bytes in memory.
4. A class can contain Friend functions. 5. A class is a blueprint or a template according to which objects are created.
  • (A) 1,3,5
  • (B) 2,4
  • (C) 3,5
  • (D) 2,4,5
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1,3,5
πŸ“Š C#
Q. Which of the following is the correct way to create an object of the
class Sample?
1. Sample s = new Sample();
2. Sample s;
3. Sample s; s =new Sample();
4. s = new Sample();
  • (A) 1,3
  • (B) 2,4
  • (C) 1,2,3
  • (D) 4,5
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1,3
πŸ“Š C#
Q. Which of the following statements is correct about constructors?
  • (A) If we provide a one-argument constructor then the compiler still provides a zero argument constructor.
  • (B) Overloaded constructors have the same name as the class name
  • (C) Overloaded constructors cannot use optional arguments.
  • (D) If we do not provide a constructor, then the compiler provides a zero-argument constructor.
πŸ’¬ Discuss
βœ… Correct Answer: (D) If we do not provide a constructor, then the compiler provides a zero-argument constructor.
πŸ“Š C#
Q. Which of the following statements is correct?
  • (A) There is one garbage collector per program running in memory.
  • (B) There is one common garbage collector for all programs.
  • (C) An object is destroyed by the garbage collector when only one reference refers to it.
  • (D) We have to specifically run the garbage collector after executing Visual Studio.NET.
πŸ’¬ Discuss
βœ… Correct Answer: (B) There is one common garbage collector for all programs.