
C# Assessment: Sample Questions | Bryq
Beginner
Intermediate
Advanced
These are three sample questions from Bryq’s C# assessment, a coding test for hiring C# developers, .NET developers and back-end engineers. The full assessment covers three levels: beginner, intermediate and advanced, from core syntax and object-oriented principles to memory management, performance and concurrency. Questions test both C# concepts and the ability to read code and predict its output, with four options and one correct answer each.
Beginner
Question
What does the following code print?
int a = 7;
int b = 2;
Console.WriteLine(a / b);
Select your answer
3
3.5
4
3.0
WHY IS THIS THE CORRECT ANSWER
When both operands are integers, C# performs integer division and discards the remainder, so 7 / 2 gives 3. To get 3.5, at least one operand must be a floating-point type, for example 7.0 / 2 or (double)a / b.
Intermediate
Question
What does the following code print?
struct Point { public int X; }
var p1 = new Point { X = 1 };
var p2 = p1;
p2.X = 5;
Console.WriteLine(p1.X);
Select your answer
1
5
0
A compile-time error
WHY IS THIS THE CORRECT ANSWER
Structs are value types, so assigning p1 to p2 copies the whole value. Changing p2.X only affects the copy. If Point were a class, both variables would refer to the same object and the output would be 5.
Advanced
Question
What does the following code print?
var list = new List<int> { 1, 2, 3 };
var query = list.Where(x => x > 1);
list.Add(4);
Console.WriteLine(query.Count());
Select your answer
3
2
4
An InvalidOperationException


