Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
C# Programming
Quiz 2: C Programming: Data Types, Constructors, Inheritance, and Exception Handling
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 1
Multiple Choice
Which of the following statements are correct about data types?1. If the integer literal exceeds the range of byte, a compilation error will occur.2. We cannot implicitly convert non-literal numeric types of larger storage size to byte.3. Byte cannot be implicitly converted to float.4. A char can be implicitly converted to only int data type. 5. We can cast the integral character codes.
Question 2
Multiple Choice
Which of the following is NOT an Integer?
Question 3
Multiple Choice
What will be the output of the following code snippet when it is executed?int x = 1;float y = 1.1f;short z = 1;Console.Write.Line((float) x + y * z - (x += (short) y) ) ;
Question 4
Multiple Choice
Which of the following is the correct size of a Decimal datatype?
Question 5
Multiple Choice
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.
Question 6
Multiple Choice
Which of the following is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified?
Question 7
Multiple Choice
Which of the following can be used to terminate a while loop and transfer control outside the loop?1. exit while2. continue3. exit statement4. break5. goto
Question 8
Multiple Choice
Which of the following statements are correct about the C#.NETcode 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 < 11 will 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.
Question 9
Multiple Choice
Which of the following is the correct output for the C#.NET code snippet given below? Console.WriteLine(13 / 2 + " " + 13 % 2) ;
Question 10
Multiple Choice
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.
Question 11
Multiple Choice
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() ;
Question 12
Multiple Choice
Which of the following statements is correct about constructors?
Question 13
Multiple Choice
Which of the following statements is correct?
Question 14
Multiple Choice
Which of the following can be facilitated by the Inheritance mechanism?1. Use the existing functionality of base class.2. Overrride the existing functionality of base class.3. Implement new functionality in the derived class.4. Implement polymorphic behaviour.5. Implement containership.
Question 15
Multiple Choice
Which one of the following statements is correct?
Question 16
Multiple Choice
Which of the following statements are correct about arrays used in C#.NET?1. Arrays can be rectangular or jagged.2. Rectangular arrays have similar rows stored in adjacent memory locations.3. Jagged arrays do not have an access to the methods of System.Array Class.4. Rectangular arrays do not have an access to the methods of System.Array Class.5. Jagged arrays have dissimilar rows stored in non-adjacent memory locations.
Question 17
Multiple Choice
Which of the following statements are correct?1. A struct can contain properties.2. A struct can contain constructors.3. A struct can contain protected data members.4. A struct cannot contain methods.5. A struct cannot contain constants.
Question 18
Multiple Choice
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) ;