Unit 2: C# Programming Fundamentals - Subjective Questions

INT402 — Modern Web Programming Tools And Techniques • Practice Questions with Detailed Answers

20 questions

1

Define variables and data types in C#. Explain the major categories of C# data types with suitable examples.

2

Write and explain a simple C# Hello World program. Describe the purpose of each major component.

3

Explain the different types of operators available in C#. What is operator precedence and how can parentheses affect an expression?

4

Describe the conditional statements supported by C#. Illustrate if, if-else, else-if ladder, and switch with examples.

5

Compare the for, while, and do-while loops in C#. Give their syntax, working, and suitable use cases.

6

Explain the purpose of the break, continue, return, and goto jump statements in C#. Provide an example of each.

7

What is an array in C#? Explain one-dimensional, multidimensional, and jagged arrays with examples.

8

Describe common techniques and methods used to manipulate arrays in C#. Explain traversal, searching, sorting, reversing, copying, and resizing.

9

Explain the string type in C# and discuss any five commonly used string methods or properties with examples.

10

How are strings manipulated in C#? Compare string concatenation, interpolation, Split, Join, and StringBuilder.

11

Define object-oriented programming. Explain its principal concepts and state the advantages of using OOP in C#.

12

Explain classes and objects in C#. Write a class containing fields, properties, and methods, and demonstrate object creation.

13

Distinguish between encapsulation and abstraction in C#. How are access modifiers, properties, abstract classes, and interfaces related to these concepts?

14

What is a constructor in C#? Explain default, parameterized, copy-style, static, and private constructors, including constructor overloading and chaining.

15

Explain inheritance in C#. Discuss base and derived classes, types of inheritance supported by C#, member accessibility, and the use of the base keyword.

16

What is polymorphism? Compare compile-time polymorphism and runtime polymorphism in C# with examples of method overloading and method overriding.

17

Explain abstract classes and abstract methods in C#. How does an abstract class differ from a concrete class and an interface?

18

Describe exception handling in C#. Explain try, catch, finally, throw, multiple catch blocks, and custom exceptions.

19

Develop a C# program that reads a collection of marks, validates the input, stores the values in an array, and displays the total, average, highest mark, and result category. Explain the concepts used.

20

Design an object-oriented C# model for an employee payroll system using encapsulation, constructors, inheritance, polymorphism, an abstract class, arrays, string manipulation, and exception handling.