Skip to main content

Basic Syntax And Data Types In C Sharp — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Basic Syntax And Data Types In C Sharp — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class Program { static void Main(string[] args) { int i; for ( i = 0; i < 5; i++) { } Console. WriteLine(i); Console. ReadLine(); } }

Question 2 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { int i ; for (i = 0; i < 5; i++) { int j = 0; j += i; Console. WriteLine(j); } Console. WriteLine( i * j); Console. ReadLine(); }

Question 3 of 40
★ FPSC ★ PPSC

What symbol is used to end a statement in C#?

Question 4 of 40
★ FPSC ★ PPSC

What is the correct syntax to declare a variable in C#?

Question 5 of 40
★ FPSC ★ PPSC

What is the purpose of the 'var' keyword in C#?

Question 6 of 40
★ FPSC ★ PPSC

Which of the following is a valid identifier in C#?

Question 7 of 40
★ FPSC ★ PPSC

What is the correct way to comment a single line in C#?

Question 8 of 40
★ FPSC ★ PPSC

What is the default value of an integer variable in C# if not explicitly initialized?

Question 9 of 40
★ FPSC ★ PPSC

Which of the following is a valid C# statement?

Question 10 of 40
★ FPSC ★ PPSC

What is the correct syntax to declare a constant in C#?

Question 11 of 40
★ FPSC ★ PPSC

What does the 'using' directive do in C#?

Question 12 of 40
★ FPSC ★ PPSC

Which data type is used to store floating-point numbers with a larger range and precision?

Question 13 of 40
★ FPSC ★ PPSC

What is the correct way to declare a string variable in C#?

Question 14 of 40
★ FPSC ★ PPSC

What is the correct syntax to create a multi-line comment in C#?

Question 15 of 40
★ FPSC ★ PPSC

Which of the following is a valid way to declare a character variable in C#?

Question 16 of 40
★ FPSC ★ PPSC

What is the correct way to declare an array of integers in C#?

Question 17 of 40
★ FPSC ★ PPSC

Which of the following is a valid way to represent the number 1000 in C#?

Question 18 of 40
★ FPSC ★ PPSC

In C#, what is the role of the 'finally' block in a try-catch-finally statement?

Question 19 of 40
★ FPSC ★ PPSC

What is the correct syntax to define a multi-line comment in C#?

Question 20 of 40
★ FPSC ★ PPSC

What is the default value of a boolean variable in C# if not explicitly initialized?

Question 21 of 40
★ FPSC ★ PPSC

What is the correct way to declare a floating-point variable with single precision in C#?

Question 22 of 40
★ FPSC ★ PPSC

Which of the following is a valid way to declare a constant string in C#?

Question 23 of 40
★ FPSC ★ PPSC

What is the output of the following code: Console.WriteLine("10" + 5);

Question 24 of 40
★ FPSC ★ PPSC

What is the default value of a reference type variable in C# if not explicitly initialized?

Question 25 of 40
★ FPSC ★ PPSC

What is the purpose of the 'foreach' loop in C#?

Question 26 of 40
★ FPSC ★ PPSC

Which data type is used to store true/false values in C#?

Question 27 of 40
★ FPSC ★ PPSC

What is the correct way to declare a multi-dimensional array in C#?

Question 28 of 40
★ FPSC ★ PPSC

What is the purpose of the 'is' keyword in C#?

Question 29 of 40
★ FPSC ★ PPSC

In C#, what is the result of the expression 5 / 2?

Question 30 of 40
★ FPSC ★ PPSC

What is the correct syntax to declare a nullable integer variable in C#?

Question 31 of 40
★ FPSC ★ PPSC

What is the purpose of the 'unchecked' keyword in C#?

Question 32 of 40
★ FPSC ★ PPSC

What is the output of the following code: Console.WriteLine($"5 + 5 = {5 + 5}");

Question 33 of 40
★ FPSC ★ PPSC

What is the correct way to declare and initialize a string variable in C#?

Question 34 of 40
★ FPSC ★ PPSC

Type of Conversion in which compiler is unable to convert the data type implicitly is?

Question 35 of 40
★ FPSC ★ PPSC

Choose ".NET class" name from which data type "UInt" is derived?

Question 36 of 40
★ FPSC ★ PPSC

Syntax for declaration and initialization of data variable is?

Question 37 of 40
★ FPSC ★ PPSC

For the following C# code select the relevant solution for conversion of data type. static void Main(string[] args) { int num1 = 20000; int num2 = 50000; long total; total = num1 + num2; Console.WriteLine("Total is : " +total); Console.ReadLine(); }

Question 38 of 40
★ FPSC ★ PPSC

Storage location used by computer memory to store data for usage by an application is?

Question 39 of 40
★ FPSC ★ PPSC

For two strings s1 and s2 to be equal, which is the correct way to find if the contents of two strings are equal?

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? int a,b; a = (b = 10) + 5;

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →