C# Objective Questions: 1. Consider The Following Code
C# Objective Questions: 1. Consider The Following Code
2. Which of the following statements is correct about the C#.NET code snippet given below?
int d;
d = Convert.ToInt32( !(30 < 20) );
3. What will be the output of the C#.NET code snippet given below?
int num = 1, z = 5;
if (!(num <= 0))
Console.WriteLine( ++num + z++ + " " + ++z );
else
Console.WriteLine( --num + z-- + " " + --z );
A. 5 6
B. 6 5
C. 6 6
D. 7 7
1. Properties
2. Methods
3. Enumerations
4. Events
5. Structures
A. 1, 3
B. 1, 2, 4
C. 3, 5
D. 4, 5
1. Inherits
2. Extends
3. inheritable
4. not inheritable
5. Sealed
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.
A. 1, 3, 5
B. 2, 4
C. 3, 5
D. 2, 4, 5
1. Exception
2. StackMemoryException
3. DivideByZeroException
4. OutOfMemoryException
5. InvalidOperationException
10. Which of the following statements are correct about exception handling in C#.NET?
1. If an exception occurs then the program terminates abruptly without getting any chance
to recover from the exception.
2. No matter whether an exception occurs or not, the statements in the finally clause (if
present) will get executed.
3. A program can contain multiple finally clauses.
4. A finally clause is written outside the try block.
5. finally clause is used to perform clean up operations like closing the network/database
connections.
12. Which of the following statements are correct about functions used in C#.NET?
A. 1, 2, 5
B. 2, 3, 5
C. 2, 3
D. 4, 5
E. None of these
A. 1
B. 0
C. Depends upon how many params arguments does it use.
D. Any number of values.
E. Depends upon how many ref arguments does it use.
14. Which of the following statements are valid about generics in .NET Framework?
A. Char
B. Long
C. Short
D. Byte
E. Integer
16. Which of the following statements is correct about properties used in C#.NET?
17. Which of the following components of the .NET framework provide an extensible
set of classes that can be used by any .NET compliant programming language?
1. Unmanaged
2. Distributed
3. Legacy
4. Managed Code
5. Native Code