You've explored the foundations of C# and the .NET ecosystem β from writing your first Console.WriteLine() to understanding the CLR compilation pipeline. Now it's time to test your knowledge with 15 carefully crafted questions.
These aren't just trivia β many of these are real interview questions asked at companies like Microsoft, Amazon, and Google. Take your time, think carefully, and remember what you learned!
π Instructions
π§ Quiz Time
0 / 15 answered
1
Who created the C# programming language?
A. James Gosling
B. Anders Hejlsberg
C. Bjarne Stroustrup
D. Guido van Rossum
Anders Hejlsberg designed C# at Microsoft around the year 2000. James Gosling created Java, Bjarne Stroustrup created C++, and Guido van Rossum created Python.
2
What does CLR stand for in the .NET ecosystem?
A. Common Library Runtime
B. Compiled Language Runtime
C. Common Language Runtime
D. Core Language Renderer
CLR stands for Common Language Runtime. It's the virtual machine component of .NET that manages code execution, memory allocation, garbage collection, and type safety.
3
What is the difference between Console.WriteLine() and Console.Write()?
A. There is no difference
B. Console.WriteLine() appends a newline character after the output; Console.Write() does not
C. Console.Write() appends a newline character; Console.WriteLine() does not
D. Console.WriteLine() can only print strings; Console.Write() can print any type
Console.WriteLine() outputs the text followed by a newline character (\n), moving the cursor to the next line. Console.Write() outputs text without a trailing newline, so subsequent output appears on the same line.
4
What is the entry point of a C# console application?
A. The first line of code in the file
B. The static void Main() method
C. The class constructor
D. The using directive
The static void Main() method is the entry point for C# console applications. When the program starts, the CLR looks for this specific method signature to begin execution. In C# 9+, top-level statements can replace this, but the compiler generates a Main method behind the scenes.
5
What intermediate format does C# code compile to before machine code?
A. Bytecode
B. Assembly Language
C. Intermediate Language (IL)
D. Binary Object Code
The C# compiler (Roslyn) compiles source code to Intermediate Language (IL), also called MSIL or CIL. This platform-independent IL code is then JIT-compiled to native machine code at runtime by the CLR. Java uses a similar concept called bytecode, but the .NET term is IL.
6
What does JIT stand for in the .NET compilation pipeline?
A. Java Integrated Translation
B. Just-In-Time
C. Joint Instruction Transfer
D. Just-In-Type
JIT stands for Just-In-Time compilation. The JIT compiler converts IL code to native machine code at runtime, method by method, as they are first called. This allows the JIT to optimize code for the specific CPU and OS it's running on.
7
Which of the following is a key difference between .NET Framework and .NET Core/.NET 5+?
A. .NET Framework is open-source; .NET Core is proprietary
B. .NET Framework is cross-platform; .NET Core is Windows-only
C. .NET Core/.NET 5+ is cross-platform and open-source; .NET Framework is Windows-only
D. There is no meaningful difference between them
.NET Framework (released 2002) is Windows-only and partially open-source. .NET Core (2016) and its successor .NET 5+ are fully cross-platform (Windows, macOS, Linux), fully open-source, and designed for modern cloud-native development.
8
What is the purpose of a 'using' directive in C#?
A. It creates a new variable
B. It imports a namespace so you can use its types without fully qualifying them
C. It allocates memory for an object
D. It includes a file from the file system
The 'using' directive imports a namespace, allowing you to reference types by their short name instead of the fully qualified name. For example, 'using System;' lets you write 'Console.WriteLine()' instead of 'System.Console.WriteLine()'. Note: 'using' has another meaning for IDisposable resource management.
9
What does the 'static' keyword mean in 'static void Main()'?
A. The method cannot be changed
B. The method runs very fast
C. The method can be called without creating an instance of the class
D. The method returns a static value
The 'static' keyword means the method belongs to the class itself, not to any specific instance (object) of the class. The CLR needs to call Main() before any objects exist, so it must be static β it's the starting point before any construction happens.
10
What is the BCL in the .NET ecosystem?
A. Basic Compiler Library
B. Base Class Library
C. Binary Code Loader
D. Base Code Language
BCL stands for Base Class Library. It's the standard library of .NET that provides fundamental types and APIs β from basic types like String and Int32 to collections, file I/O, networking, threading, and more. It's the toolbox every .NET developer relies on.
11
In which year was C# first released?
A. 1995
B. 2000
C. 2005
D. 1991
C# was first released in 2000 as part of the .NET Framework initiative. It was publicly announced at the Professional Developers Conference (PDC) in July 2000 and shipped with .NET Framework 1.0 in 2002. The language was designed starting in 1999.
12
Which game engine uses C# as its primary scripting language?
What is the correct C# compilation pipeline order?
A. C# β Machine Code β IL β Execution
B. C# β IL β JIT β Native Machine Code
C. C# β Bytecode β Interpreter β Output
D. C# β Assembly β Linker β Executable
The C# compilation pipeline is: Source Code β Roslyn Compiler β Intermediate Language (IL) β JIT Compiler (at runtime) β Native Machine Code. The two-step process allows platform independence: IL is portable, and JIT optimizes for the specific target hardware.
14
What happens if you omit the semicolon at the end of a C# statement?
A. The code runs but gives a warning
B. The compiler throws a syntax error (CS1002)
C. The statement is ignored
D. A semicolon is automatically inserted
C# requires semicolons to terminate statements. Omitting one results in compiler error CS1002: '; expected'. Unlike JavaScript, C# does NOT have automatic semicolon insertion. The compiler strictly enforces this rule to prevent ambiguity.
15
Which of the following is a valid Main method signature in C#?
A. public void Main()
B. static int Main(string[] args)
C. static main()
D. public static void main()
Valid Main method signatures include: static void Main(), static void Main(string[] args), static int Main(), and static int Main(string[] args) β plus their async Task variants. Option B is valid because it's static and returns int. Option A is missing 'static'. Option C is missing the return type and has lowercase 'm'. Option D has lowercase 'main' β C# is case-sensitive and requires capital 'M'.