Home > Information Technology > Programming Languages > Basics of CSharp
25 QuestionsLog inwatch on youtube 
00:00:00

ЁЯОБ Claim Rewards

ЁЯОБ Login to earn rewards !!!



25 uniquely designed questions just for you to evaluate your skills in Basics of CSharp quiz. Are you ready to challenge yourself and explore more? Let's get started and see how much you can score out of 25.

Please feel free to report any corrections if you come across any inaccuracies or errors. Your feedback is valuable in maintaining the accuracy of our content.

Questions

1. What does C# stand for?
Answer: C-Sharp
Explanation: C# stands for C-Sharp.Report for correction
2. Which of the following is a valid C# identifier?
Answer: class
Explanation: The valid C# identifier among these is class.Report for correction
3. Which access modifier makes a member accessible only within its own class?
Answer: private
Explanation: private access modifier makes a member accessible only within its own class.Report for correction
4. Which of the following keyword is used for including the namespaces in the program in C#?
Answer: using
Explanation: The keyword used for including the namespaces in the program of C# is 'using'.Report for correction
5. Which data type is used to store whole numbers in C#?
Answer: int
Explanation: To store whole numbers in C# int datatype is used.Report for correction
6. What is the C# equivalent of the 'if' statement in C++?
Answer: if
Explanation: The C# equivalent of the 'if' statement in C++ is also 'if'.Report for correction
7. Which C# keyword is used to create an instance of a class?
Answer: new
Explanation: The keyword used to create an instance of a class in C# is 'new'.Report for correction
8. Which of the following is used to handle exceptions in C#?
Answer: try-catch-finally
Explanation: To handle exceptions in C#; Try-catch-finally block is used.Report for correction
9. Which of the following is NOT a primitive data type in C#?
Answer: string
Explanation: All others are primitive data type; where as string is non primitive data type.Report for correction
10. In C#; which keyword is used to declare a class?
Answer: class
Explanation: The keyword used in C# to declare a class is 'class'.Report for correction
11. Which C# access modifier provides the widest level of access?
Answer: public
Explanation: The public modifier has the widest scope. When a class or its members declared public they are accessible from everywhere.Report for correction
12. Which C# loop construct is used to iterate through an array or collection?
Answer: foreach
Explanation: The foreach loop in C# iterates items in a collection; like an array or a list.Report for correction
13. Which keyword is used to handle exceptions in C#?
Answer: catch
Explanation: To handle exceptions 'catch' block is used.Report for correction
14. Which of the following converts a type to a string in C#?
Answer: ToString
Explanation: The method which is used to convert a type to string is ToString().Report for correction
15. Which of the following is the default access specifier of a class member function?
Answer: private
Explanation: Default access specifier for the class member function is Private.Report for correction
16. Which of the following is not a namespace in the .NET Framework Class Library?
Answer: System.Process
Explanation: Process class is part of System.Diagnostics namespace.Report for correction
17. Which of these methods is a rounding function of Math class?
Answer: Round()
Explanation: To round up a variable to nearest integer; Round() method is used.Report for correction
18. Which of the following functions return absolute value of a variable?
Answer: Abs()
Explanation: To return the absolute value of a Decimal number Abs() function is used.Report for correction
19. The capability of an object in C# to take number of different forms and hence display behaviour as according is known as?
Answer: Polymorphism
Explanation: Polymorphism allows a class to have multiple implementations with the same name. It is one of the core principles of Object Oriented Programming.Report for correction
20. When a value type is converted to object type; it is called as what?
Answer: boxing
Explanation: When a value type is converted to object type; it is called as boxing.Report for correction
21. When a object type is converted to value type; it is called as what?
Answer: Unboxing
Explanation: When a object type is converted to value type; it is called as Unboxing.Report for correction
22. In C#; which access modifier is used to specify that a class member can only be accessed within its own class and derived classes?
Answer: protected
Explanation: To allow a class member to be accessed within its own class and derived class 'protected' access modifier to be used.Report for correction
23. In C#; which access modifier is used to declare a class member that can be accessed only within its own class?
Answer: private
Explanation: To allow a class member to be accessed within its own class alone; 'private' access modifier to be used.Report for correction
24. In C#; which keyword is used to define a class that cannot be instantiated and may only contain static members?
Answer: static
Explanation: When static keyword is used in a class; the compiler will guarantee that instances of this class cannot be created.Report for correction
25. Which of the following is not a valid data type in C#?
Answer: number
Explanation: The number is not a valid data type in C#.Report for correction