1. How many Bytes are stored by "Long' Deta type in C# .net ?
(A) 8
(B) 4
(C) 2
(D) 1
ANS: (A) 8
2. Correct Declaration of Values to variables 'a' and 'b':
(A) int a = 32, b 40.6;
(B) int a = 42, b= 40;
(C) int a = b=42;
(D) int a =32; int b 40;
ANS: (D) 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 ?
(A) sbyte
(B) short
(C) int
(D) long
ANS: (A) sbyte
4. Default type of number without decimal is:
(A) long int
(B) unsigned long
(C) int
(D) unsigned int
5. Valid size of float data type is :
ANS: (C) int
(A) 10 Bytes
(B) 4 Bytes
(C) 6 Bytes
(D) 8 Bytes
ANS: (B) 4 Bytes
6. The Default value of Boolean Data Type is :
(A) 0
(B) True
(C) False
(D) 1
ANS: (C) False
7. Storage location used by computer memory to store data for usage by an application is :
(A) Pointers
(B) Constants
(C) Variable
(D) None of the above
ANS: (C) Variable
8. What will be the output of the following C# code ? int a, b; a = (b = 10) + 5;
(A) a = 15, b = 10
(B) b= 10, a = 5
(C) b= 15, a =5
(D) a = 10, b=10
9. Correct order of priorities are :
ANS: (A) a = 15, b = 10
9. Correct order of priorities are :
(A) "> %' > *'>+
(B) ">***> %'> +
(C) ***> /* > %'> +'
(D) %'>**>" > +
ANS: (B) ">***> %'> +
10. The correct way of incrementing the operators are :
(A) ++a++
(B) b++1
(C) c+=1
(D) d=+1
ANS: (C) c+=1
11. What is the advantage of using 2D jagged array over 2D rectangular array ?
(A) Easy initialization of elements
(B) Allows unlimited elements as well as rows which had '0' or are empty in nature
(C) Both of the above
(D) None of the above
ANS: (B) Allows unlimited elements as well as rows which had '0' or are empty in nature
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( );
(A) -127 to +127
(B) 0 to 127
(C) Infinite loop condition
(D) 1
13. Which of the following is a contextual keyword in C# ?
ANS: (D) 1
13. Which of the following is a contextual keyword in C# ?
(A) get
(B) set
(C) add
(D) All of the above
ANS: (D) All of the above
14. Which of the following converts a type to a single Unicode character, where possible in C# ?
(A) ToSingle
(B) ToByte
(C) ToChar
(D) ToDateTime
ANS: (C) ToChar
15. Which of the following property of array class in C# checks whether the array is read-only ?
(A) IsReadOnly
(B) IsFixedSize
(C) Length
(D) None of the above
ANS: (A) IsReadOnly
16. Which of the following is true about exceptions in C#?
(A) The exception classes in C# are mainly directly indirectly or derived from the System.Exception class.
(B) C# exceptions are represented by classes.
(C) Both (A) and (B)
(D) None of the above
ANS: (C) Both (A) and (B)
17. Which of the following is used to define the member of a class externally ?
(A) :
(B) ::
(C) #
(D) None of the above
ANS: (B) ::
18. The operator used to access member function of a class ?
(A) :
(B) ::
(C) .
(D) #
ANS: (C) .
19. What is the most specified using class declaration ?
(A) type
(B) scope
(C) type and scope
(D) None of the above
ANS: (C) type and scope
20. Which of the following statements about objects in "C#" is correct ?
(A) Everything you use in C# is an object, including Windows Forms and controls.
(B) Objects have methods and events that allow them to perform actions.
(C) All objects created from a class will occupy equal number of bytes in memory.
(D) All of the above
21. The data members of a class by default are :
ANS: (D) All of the above
21. The data members of a class by default are :
(A) private
(B) public, protected
(C) private, public
(D) public
ANS: (A) private
22. The number of levels of inheritance are
(A) 5
(B) 4
(C) 3
(D) 2
ANS: (B) 4
23. Which procedure among the following should be used to implement a 'Has a' or a 'Kind of relationship between two entities ?
(A) Inheritance
(B) Polymorphism
(C) Templates
(D) All of the above
ANS: (A) Inheritance
24. Select the class visibility modifiers among the followving:
(A) Private, protected, public, internal
(B) Private, protected, public, internal, protected internal
(C) Private, protected, public
(D) All of the above
ANS: (B) Private, protected, public, internal, protected internal
25. In Inheritance concept, which of the following members of base class are accessible to derived class members ?
(A) Static
(B) Protected
(C) Private
(D) Shared
ANS: (B) Protected
26. Which of the following functionality is facilitated by inheritance mechanism ?
(A) Use the existing functionality of base class
(B) Override the existing functionality of base class
(C) Implements new functionality in derived class
(D) All of the above
ANS: (D) All of the above
27. If no access modifier for a class is specified, then class accessibility is defined as :
(A) Public
(B) Protected
(C) Private
(D) 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);'
ANS: (C) Private
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);'
(A) Dr. Gupta
(B) Good Morning
(C) Good Morning Dr. Gupta
(D) Good Morning name
ANS: (C) Good Morning Dr. Gupta
29. Storage location used by computer memory to store data for usage by an application is:
(A) Variable
(B) Constants
(C) Pointers
(D) None of the above
ANS: (A) Variable
30. Which of the following statements about objects in "C#" is correct ?
(A) Everything you use in C# is an object, including Windows Forms and controls.
(B) Objects have methods and events that allow them to perform actions.
(C) All objects created from a class will occupy equal number of bytes in memory.
(D) 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
ANS: (D) 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
(A) T Encapsulation
(B) Polymorphism
(C) Abstraction
(D) None of the above
ANS: (B) Polymorphism
32. Correct way to overload + operator:
(A) public sample operator + (sample a, sample b)
(B) public abstract operator + (sample a, sample b) public static sample operator +
(C) (sample a, sample b)
(D) All of the above
ANS:(D) All of the above
33. Which of the following statements is correct ?
(A) Each derived class does not have its own version of a virtual method.
(B) If a derived class does not have its own version of virtual method, then one in base class is used.
(C) By default methods are virtual.
(D) All of the above
ANS: (B) If a derived class does not have its own version of virtual method, then one in base class is used.
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:
(A) Static binding
(B) Static linking
(C) Compile time polymorphism
(D) All of the above
ANS: (D) All of the above
35. Select the correct statement about an exception :
(A) It occurs during loading of program.
(B) It occurs during Just-In-Time compilation.
(C) It occurs at run time.
(D) All of the above
ANS: (C) It occurs at run time.
1 Comments
Great Work! You are providing HNBGU Previous year question papers which are going to help students a lot.
ReplyDeleteKeep it up your best work.