C# is a programming language. What is it mainly used for?
Think about what kind of programs you can build with C# on Windows.
C# is mainly used to build Windows desktop apps, web services, and games using frameworks like .NET.
Look at this C# program. What will it print?
using System; class Program { static void Main() { int x = 5; int y = 3; Console.WriteLine(x + y); } }
Adding two numbers returns their sum.
The program adds 5 and 3, printing 8.
What error will this code cause when run?
using System; class Program { static void Main() { int number = "10"; Console.WriteLine(number); } }
Check the type assigned to an integer variable.
You cannot assign a string value to an int variable in C# without conversion.
Choose the correct way to declare a method that returns an integer and takes no parameters.
Remember the order: return type, method name, parentheses, braces.
Option A follows correct C# syntax for method declaration.
Consider this code snippet. What is the value of result after execution?
using System; class Program { static int Multiply(int a, int b = 2) { return a * b; } static void Main() { int result = Multiply(3); Console.WriteLine(result); } }
Check the default value of parameter b.
The method Multiply uses default value 2 for b, so 3 * 2 = 6.