C# Questions - Console I/O, Comments, Preprocessor Directives etc.

Take This Test

Section 1

1) What is the output of following code?

double d = 0.524;
Console.WriteLine(“{0:#.00}”, d);

2) Match each XML documentation tag(in columns) used in c# with its proper description(in rows).
3) Select all valid variable declarations.
4) Identify the variable declared in Pascal Notation?
5) The XML doc comments are not metadata; but they are included in the compiled assembly and therefore they are accessible through reflection.

Is this statement correct?

6) Is it possible to include custom tags in XML documentation of C# Code? Check the code sample provided below and say whether it will compile properly with out any error or not.

/// <myowntag>This is my own tag;</myowntag>
public void WorkerFunction(String param1) { }

7) Select the correct command to generate XML Documentation file of Sample.cs code file using visual studio command prompt.

C# Preprocessor Directives

Preprocessor directives affect aspects of the compilation process. Preprocessor directives can be used to prevent the compiler from compiling code a particular piece of code. Preprocessor commands never actually get translated to any commands in the executable code.

1) Select preprocessor command used to declare and remove a symbol.
2) What is the compiled out put of following code?

#define PROFESSIONAL
#define W2K

#if ENTERPRISE
 Console.WriteLine("Windows Server Enterprize Edition");
 #if W2K
  Console.WriteLine("Windows 2000");
 #endif
#elif PROFESSIONAL
 #if W2K
  Console.WriteLine("Windows 2000");
 #else
  Console.WriteLine("C# Professional 2.0");
 #endif
#else
 Console.WriteLine("Dot Net Frame Work");
#endif

3) What is the compiled output of following code?

#define CSHARPQUESTION
#if CSHARPQUESTION && (ENTERPRISESERVER==false)
Console.WriteLine("SAMPLE C# QUESTIONS");
#else
Console.WriteLine("C# EXAMS");
#endif

4) Match the Preprocessor Directives(in Column) with their Description and Use(in Rows).

Take This Test

Also check these C# test papers, these are one of most attempted test paper in this category.

Popular C# Papers

Test Paper of Classes In C#
Miscelleaneas questions related to Class and Objects in C#. Test paper 14 questions with a time lim...
Objects and Types in C#
Test focuses on object oriented concepts implemented in C#. Knowledge of Object Oriented Programin...
C# General Questions
Test your C# knowledge.
C# Questions - Console I/O, Comments, Preprocessor Directives etc.
C# Questions on Console I/O, Comments, Preprocessor Directives, Objects and Types.
C Sharp Fundamentals
Copy Of C# General Questions
Test your C# knowledge.