C Sharp # Solved MCQ 2020-21 | BCA 5 semester | HNBGU

C Sharp # Solved MCQ 2020-21

BCA 5 semester | HNBGU

  1. How many Bytes are stored by "Long' Deta type in C# .net ?
    1. 8
    2. 4
    3. 2
    4. 1


  2. Correct Declaration of Values to variables 'a' and 'b':
    1. int a = 32, b 40.6;
    2. int a = 42, b= 40;
    3. int a = b=42;
    4. int a =32; int b 40;


  3. Which data type should be more preferred for storing a simple number like 35 to improve execution speed of a program ?
    1. sbyte
    2. short
    3. int
    4. long


  4. Default type of number without decimal is:
    1. long int
    2. unsigned long
    3. int
    4. unsigned int


  5. Valid size of float data type is :
    1. 10 Bytes
    2. 4 Bytes
    3. 6 Bytes
    4. 8 Bytes


  6. The Default value of Boolean Data Type is :
    1. 0
    2. True
    3. False
    4. 1


  7. Storage location used by computer memory to store data for usage by an application is :
    1. Pointers
    2. Constants
    3. Variable
    4. None of the above


  8. What will be the output of the following C# code ? int a, b; a = (b = 10) + 5;
    1. a = 15, b = 10
    2. b= 10, a = 5
    3. b= 15, a =5
    4. a = 10, b=10


  9. Correct order of priorities are :
    1. "> %' > *'>+
    2. ">***> %'> +
    3. ***> /* > %'> +'
    4. %'>**>" > +


  10. The correct way of incrementing the operators are :
    1. ++a++
    2. b++1
    3. c+=1
    4. d=+1


  11. What is the advantage of using 2D jagged array over 2D rectangular array ?
    1. Easy initialization of elements
    2. Allows unlimited elements as well as rows which had '0' or are empty in nature
    3. Both of the above
    4. None of the above


  12. What will be the output of the following C# code ?
    static void main (string[] args)
        int i = 0;
            while (i++!=0);
                Console.WriteLine(i);
                Console.ReadLine( ); 
                    
    1. -127 to +127
    2. 0 to 127
    3. Infinite loop condition
    4. 1


  13. Which of the following is a contextual keyword in C# ?
    1. get
    2. set
    3. add
    4. All of the above


  14. Which of the following converts a type to a single Unicode character, where possible in C# ?
    1. ToSingle
    2. ToByte
    3. ToChar
    4. ToDateTime


  15. Which of the following property of array class in C# checks whether the array is read-only ?
    1. IsReadOnly
    2. IsFixedSize
    3. Length
    4. None of the above


  16. Which of the following is true about exceptions in C#?
    1. The exception classes in C# are mainly directly indirectly or derived from the System.Exception class.
    2. C# exceptions are represented by classes.
    3. Both (A) and (B)
    4. None of the above


  17. Which of the following is used to define the member of a class externally ?
    1. :
    2. ::
    3. #
    4. None of the above


  18. The operator used to access member function of a class ?
    1. :
    2. ::
    3. .
    4. #


  19. What is the most specified using class declaration ?
    1. type
    2. scope
    3. type and scope
    4. None of the above


  20. Which of the following statements about objects in "C#" is correct ?
    1. Everything you use in C# is an object, including Windows Forms and controls.
    2. Objects have methods and events that allow them to perform actions.
    3. All objects created from a class will occupy equal number of bytes in memory.
    4. All of the above


  21. The data members of a class by default are :
    1. private
    2. public, protected
    3. private, public
    4. public


  22. The number of levels of inheritance are :
    1. 5
    2. 4
    3. 3
    4. 2


  23. Which procedure among the following should be used to implement a 'Has a' or a 'Kind of relationship between two entities ?
    1. Inheritance
    2. Polymorphism
    3. Templates
    4. All of the above


  24. Select the class visibility modifiers among the following:
    1. Private, protected, public, internal
    2. Private, protected, public, internal, protected internal
    3. Private, protected, public
    4. All of the above


  25. In Inheritance concept, which of the following members of base class are accessible to derived class members ?
    1. Static
    2. Protected
    3. Private
    4. Shared


  26. Which of the following functionality is facilitated by inheritance mechanism ?
    1. Use the existing functionality of base class
    2. Override the existing functionality of base class
    3. Implements new functionality in derived class
    4. All of the above


  27. If no access modifier for a class is specified, then class accessibility is defined as :
    1. Public
    2. Protected
    3. Private
    4. Internal


  28. What will be the output of the following C# code ? static void Main(string[ ] args) String name "Dr. Gupta"; Console. WriteLine ("Good Morning"+ name);'
    1. Dr. Gupta
    2. Good Morning
    3. Good Morning Dr. Gupta
    4. Good Morning name


  29. Storage location used by computer memory to store data for usage by an application is:
    1. Variable
    2. Constants
    3. Pointers
    4. None of the above


  30. Which of the following statements about objects in "C#" is correct ?
    1. Everything you use in C# is an object, including Windows Forms and controls.
    2. Objects have methods and events that allow them to perform actions.
    3. All objects created from a class will occupy equal number of bytes in memory.
    4. All of the mentioned


  31. The capability of an object in C# to take number of different forms and hence display behaviour as according is known as :
    1. Encapsulation
    2. Polymorphism
    3. Abstraction
    4. None of the above


  32. Correct way to overload + operator:
    1. public sample operator + (sample a, sample b)
    2. public abstract operator + (sample a, sample b) public static sample operator +
    3. (sample a, sample b)
    4. All of the above


  33. Which of the following statements is correct ?
    1. Each derived class does not have its own version of a virtual method.
    2. If a derived class does not have its own version of virtual method, then one in base class is used.
    3. By default methods are virtual.
    4. All of the above


  34. Selecting appropriate method out of number of overloaded methods by matching arguments in terms of number, type and order and binding that selected method to object at compile time is called:
    1. Static binding
    2. Static linking
    3. Compile time polymorphism
    4. All of the above


  35. Select the correct statement about an exception :
    1. It occurs during loading of program.
    2. It occurs during Just-In-Time compilation.
    3. It occurs at run time.
    4. All of the above