Home Subjects C# Programming

C# Programming

C# and .NET for campus placement

76 Q 4 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 21–30 of 76
Topics in C# Programming
Q.21 Easy OOP in C#
In C#, what is the primary purpose of using an interface?
A To provide complete implementation of methods
B To define a contract that classes must implement
C To create a concrete object directly
D To restrict inheritance to a single class
Correct Answer:  B. To define a contract that classes must implement
EXPLANATION

Interfaces in C# define a set of method and property declarations that implementing classes must provide, establishing a contract without implementation details.

Test
Q.22 Easy OOP in C#
Which of the following is NOT a pillar of OOP in C#?
A Inheritance
B Polymorphism
C Encapsulation
D Compilation
Correct Answer:  D. Compilation
EXPLANATION

The four pillars of OOP are Inheritance, Polymorphism, Encapsulation, and Abstraction. Compilation is a language feature, not an OOP principle.

Test
Q.23 Easy OOP in C#
In C#, what is the correct syntax to implement multiple interfaces in a class?
A class MyClass : Interface1, Interface2 { }
B class MyClass implements Interface1, Interface2 { }
C class MyClass : Interface1 : Interface2 { }
D class MyClass inherits Interface1, Interface2 { }
Correct Answer:  A. class MyClass : Interface1, Interface2 { }
EXPLANATION

C# uses colon (:) to implement interfaces, and multiple interfaces are separated by commas. The 'implements' keyword is used in Java, not C#.

Test
Q.24 Easy OOP in C#
Which keyword is used to create a class that cannot be instantiated in C#?
A sealed
B abstract
C static
D readonly
Correct Answer:  B. abstract
EXPLANATION

The 'abstract' keyword prevents instantiation of a class and forces derived classes to implement abstract members, establishing a contract for subclasses.

Test
Q.25 Easy OOP in C#
What is the primary purpose of encapsulation in OOP?
A To increase code execution speed
B To hide internal implementation details and control access to data
C To reduce memory consumption
D To allow multiple inheritance
Correct Answer:  B. To hide internal implementation details and control access to data
EXPLANATION

Encapsulation bundles data and methods together, hiding internal implementation and controlling access through public interfaces, improving maintainability and security.

Test
Q.26 Easy ASP.NET Basics
What does MVC stand for in ASP.NET MVC?
A Model-View-Controller
B Module-Virtual-Component
C Multi-View-Cache
D Main-Variable-Class
Correct Answer:  A. Model-View-Controller
EXPLANATION

MVC (Model-View-Controller) is an architectural pattern separating data (Model), presentation (View), and business logic (Controller).

Test
Q.27 Easy ASP.NET Basics
In ASP.NET Core, what is the purpose of the appsettings.json file?
A To store application configuration settings
B To define database schema
C To configure IIS settings
D To manage user authentication only
Correct Answer:  A. To store application configuration settings
EXPLANATION

appsettings.json stores application configuration like connection strings, logging levels, and custom settings.

Test
Q.28 Easy ASP.NET Basics
What does CLR stand for in the context of .NET?
A Common Language Runtime
B Compiled Language Resolver
C Common Library Resource
D Core Language Repository
Correct Answer:  A. Common Language Runtime
EXPLANATION

CLR (Common Language Runtime) is the virtual machine that executes .NET code, managing memory, security, and type safety.

Test
Q.29 Easy ASP.NET Basics
Which of the following is the latest version of ASP.NET as per 2024-2025?
A ASP.NET Framework 4.8
B ASP.NET Core 8.0
C ASP.NET MVC 5
D ASP.NET Web Forms
Correct Answer:  B. ASP.NET Core 8.0
EXPLANATION

ASP.NET Core 8.0 is the latest unified platform as of 2024-2025, replacing the older ASP.NET Framework.

Test
Q.30 Easy ASP.NET Basics
What is the primary purpose of ASP.NET in web development?
A A server-side framework for building dynamic web applications
B A client-side scripting language
C A database management system
D A markup language for creating web pages
Correct Answer:  A. A server-side framework for building dynamic web applications
EXPLANATION

ASP.NET is a server-side web application framework developed by Microsoft for building dynamic, interactive web applications.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips