C#.NET objective type questions and answers

1. Which of the following statements are correct?
a. The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. (True)
b. The as operator in C#.NET is used to perform conversions between compatible reference types. (True)
c. The &* operator is also used to declare pointer types and to dereference pointers. (False!)
d. The -> operator combines pointer dereferencing and member access. (True)
e. In addition to being used to specify the order of operations in an expression, brackets [ ] are used to specify casts or type conversions. (False!)
Correct answers: a, b, d
Not answered
2. Which of the following statements is correct about Bitwise ^ operator used in C#.NET?
a. The ^ operator can be used to put ON a bit. (False!)
b. The ^ operator can be used to put OFF a bit. (False!)
c. The ^ operator can be used to Invert a bit. (True)
d. The ^ operator can be used to check whether a bit is ON. (False!)
e. The ^ operator can be used to check whether a bit is OFF. (False!)
Correct answers: c
Not answered
3. Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly?
a. n = n && HF7 (False!)
b. n = n & 16 (False!)
c. n = n & 0xF7 (True)
d. n = n & HexF7 (False!)
e. n = n & 8 (False!)
Correct answers: c
Not answered
4. Which of the following statements is correct about Bitwise | operator used in C#.NET?
a. The | operator can be used to put OFF a bit. (False!)
b. The | operator can be used to Invert a bit. (False!)
c. The | operator can be used to check whether a bit is ON. (False!)
d. The | operator can be used to check whether a bit is OFF. (False!)
e. The | operator can be used to put ON a bit. (True)
Correct answers: e
Not answered
5. Which of the following is NOT an Assignment operator in C#.NET?
a. \= (True)
b. /= (False!)
c. *= (False!)
d. += (False!)
e. %= (False!)
Correct answers: a
Not answered
6. Which of the following is the correct output for the C#.NET code snippet given below?
Console.WriteLine(13 / 2 + " " + 13 % 2);
a. 6.5 1 (False!)
b. 6.5 0 (False!)
c. 6 0 (False!)
d. 6 1 (True)
e. 6.5 6.5 (False!)
Correct answers: d
Not answered
7. Which of the following statements are correct about the Bitwise & operator used in C#.NET?
a. The & operator can be used to Invert a bit. (False!)
b. The & operator can be used to put ON a bit. (False!)
c. The & operator can be used to put OFF a bit. (True)
d. The & operator can be used to check whether a bit is ON. (True)
e. The & operator can be used to check whether a bit is OFF. (True)
Correct answers: c, d, e
Not answered
8. Which of the following are Logical operators in C#.NET?
a. && (True)
b. || (True)
c. ! (True)
d. Xor (False!)
e. % (False!)
Correct answers: a, b, c
Not answered
9. Which of the following are the correct ways to increment the value of variable a by 1?
a. ++a++; (False!)
b. a += 1; (True)
c. a ++ 1; (False!)
d. a = a +1; (True)
e. a = +1; (False!)
Correct answers: b, d
Not answered
10. Which of the following are NOT Relational operators in C#.NET?
a. >= (False!)
b. != (False!)
c. Not (True)
d. <= (False!)
e. <>= (True)
Correct answers: c, e
Not answered
11. Which of the following is NOT a Bitwise operator in C#.NET?
a. & (False!)
b. | (False!)
c. '<<' (True)
d. ^ (False!)
e. ~ (False!)
Correct answers: c
Not answered
12. Which of the following statements is correct?
a. A constructor can be used to set default values and limit instantiation. (True)
b. C# provides a copy constructor. (False!)
c. Destructors are used with classes as well as structures. (False!)
d. A class can have more than one destructor. (False!)
Correct answers: a
Not answered
13. Which of the following statements are correct about static functions?
a. Static functions can access only static data. (True)
b. Static functions cannot call instance functions. (True)
c. It is necessary to initialize static data. (False!)
d. Instance functions can call static functions and access static data. (True)
e. this reference is passed to static functions. (False!)
Correct answers: a, b, d
Not answered
14. 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. (False!)
b. Static constructors can use optional arguments. (False!)
c. Overloaded constructors cannot use optional arguments. (False!)
d. If we do not provide a constructor, then the compiler provides a zero-argument constructor. (True)
Correct answers: d
Not answered
15. In which of the following should the methods of a class differ if they are to be treated as overloaded methods?
a. Type of arguments (True)
b. Return type of methods (False!)
c. Number of arguments (True)
d. Names of methods (False!)
e. Order of arguments (True)
Correct answers: a, c, e
Not answered
16. Which of the following statements are correct about constructors in C#.NET?
a. Constructors cannot be overloaded. (False!)
b. Constructors always have the name same as the name of the class. (True)
c. Constructors are never called explicitly. (True)
d. Constructors never return any value. (True)
e. Constructors allocate space for the object in memory. (False!)
Correct answers: b, c, d
Not answered
17. How many times can a constructor be called during lifetime of the object?
a. As many times as we call it. (False!)
b. Only once. (True)
c. Depends upon a Project Setting made in Visual Studio.NET. (False!)
d. Any number of times before the object gets garbage collected. (False!)
e. Any number of times before the object is deleted. (False!)
Correct answers: b
Not answered
18. Which of the following statements is correct?
a. There is one garbage collector per program running in memory. (False!)
b. There is one common garbage collector for all programs. (True)
c. An object is destroyed by the garbage collector when only one reference refers to it. (False!)
d. We have to specifically run the garbage collector after executing Visual Studio.NET. (False!)
Correct answers: b
Not answered
19. Which of the following statements are correct about static functions?
a. Static functions are invoked using objects of a class. (False!)
b. Static functions can access static data as well as instance data. (False!)
c. Static functions are outside the class scope. (False!)
d. Static functions are invoked using class. (True)
Correct answers: d
Not answered
20. Which of the following statements is correct about constructors in C#.NET?
a. A constructor cannot be declared as private. (False!)
b. A constructor cannot be overloaded. (False!)
c. A constructor can be a static constructor. (True)
d. A constructor cannot access static data. (False!)
e. this reference is never passed to a constructor. (False!)
Correct answers: c
Not answered
   
Today's date:
Total spent time:
Total answered question:
Total unanswered question:





Post a Comment

0 Comments