BSc CSIT (TU) Science NET Centric Computing (BSc CSIT, CSC367) Question Paper 2079 Nepal
This is the official BSc CSIT (TU) (Science stream) NET Centric Computing (BSc CSIT, CSC367) question paper for 2079, as set in the regular annual examination. It carries 60 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this NET Centric Computing (BSc CSIT, CSC367) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BSc CSIT (TU) NET Centric Computing (BSc CSIT, CSC367) exam or solving previous years' question papers, this 2079 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
How does the system manage state in stateless HTTP? Explain the different state management techniques in ASP.NET Core with examples.
State Management in Stateless HTTP
HTTP is a stateless protocol — each request/response is independent and the server does not inherently remember anything about previous requests from the same client. To create the illusion of continuity (e.g. a logged-in user, a shopping cart), the application must explicitly store and re-associate state with each client across requests, typically by passing an identifier (such as a cookie or token) back and forth and storing the data either on the client or on the server keyed by that identifier.
State Management Techniques in ASP.NET Core
1. Cookies (Client-side)
Small key-value data stored in the browser and sent with every request to the same domain.
Response.Cookies.Append("theme", "dark");
string theme = Request.Cookies["theme"];
2. Session State (Server-side)
Data is kept on the server (in memory or a distributed cache) and identified by a session cookie holding the session ID.
// Program.cs
builder.Services.AddDistributedMemoryCache();
builder.Services.AddSession();
app.UseSession();
// In a controller
HttpContext.Session.SetString("User", "Ram");
string user = HttpContext.Session.GetString("User");
3. TempData
Used to pass data between two consecutive requests (e.g. across a redirect after a POST). Backed by session or cookies and cleared after it is read.
TempData["Message"] = "Record saved successfully";
// available in the next request only
4. Query Strings
State carried in the URL.
/products?category=books&page=2
string cat = Request.Query["category"];
5. Hidden Form Fields
Values round-tripped inside a form so they survive a POST.
<input type="hidden" asp-for="Id" />
6. Cache (Application-wide)
IMemoryCache / distributed cache stores shared data on the server, not tied to a single user.
_cache.Set("rates", data, TimeSpan.FromMinutes(10));
Summary Table
| Technique | Stored where | Scope |
|---|---|---|
| Cookies | Browser | Per user |
| Session | Server | Per user session |
| TempData | Session/cookie | Next request only |
| Query string | URL | Single request |
| Hidden field | Form/page | Single round-trip |
| Cache | Server | Application-wide |
Explain dependency injection and the IoC container in ASP.NET Core. How is a service registered and consumed? Give an example.
Dependency Injection (DI) and the IoC Container
Dependency Injection is a design pattern in which an object's dependencies (the services it needs) are supplied to it from outside rather than being created inside the object itself. This implements the principle of Inversion of Control (IoC) — control over object creation and lifetime is inverted from the class to a central container.
ASP.NET Core has a built-in IoC container (IServiceProvider). It is responsible for:
- Creating service instances when requested,
- Resolving and injecting their dependencies recursively,
- Managing each service's lifetime.
Benefits: loose coupling, easier unit testing (mock injection), and centralized configuration.
Service Lifetimes
| Lifetime | Method | Behaviour |
|---|---|---|
| Transient | AddTransient | New instance every time it is requested |
| Scoped | AddScoped | One instance per HTTP request |
| Singleton | AddSingleton | One instance for the application lifetime |
Registering a Service
Services are registered in Program.cs against the DI container, usually as an interface mapped to an implementation:
builder.Services.AddScoped<IMessageService, EmailService>();
Consuming a Service (Constructor Injection)
The container injects the dependency through the constructor:
public interface IMessageService
{
string Send(string to);
}
public class EmailService : IMessageService
{
public string Send(string to) => $"Email sent to {to}";
}
public class HomeController : Controller
{
private readonly IMessageService _msg;
// ASP.NET Core injects EmailService automatically
public HomeController(IMessageService msg)
{
_msg = msg;
}
public IActionResult Index()
{
return Content(_msg.Send("ram@example.com"));
}
}
The controller depends only on the abstraction IMessageService; the concrete EmailService can be swapped (e.g. with a mock) without changing the controller.
Explain the ASP.NET Core request processing pipeline and middleware. Write a custom middleware component.
The ASP.NET Core Request Processing Pipeline
When a request reaches an ASP.NET Core app, it flows through a pipeline of middleware components. Each middleware can:
- Inspect/modify the incoming request,
- Pass control to the next middleware by calling
next(), and - Inspect/modify the outgoing response on the way back.
Because control passes forward and then unwinds backward, the pipeline behaves like a series of nested layers ("Russian-doll" model). A middleware may also short-circuit the pipeline by not calling next() (e.g. authentication failure returning 401).
Request ─▶ [Logging] ─▶ [Routing] ─▶ [Auth] ─▶ [Endpoint]
◀── Response ◀────────────────────────┘
Middleware
Middleware is software assembled into the pipeline to handle requests and responses. The order of registration in Program.cs defines execution order. Common built-in middleware:
UseExceptionHandler,UseHttpsRedirection,UseStaticFiles,UseRouting,UseAuthentication,UseAuthorization,MapControllers.
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
Custom Middleware Component
A simple inline middleware that logs the request path and timing:
app.Use(async (context, next) =>
{
Console.WriteLine($"Incoming: {context.Request.Path}");
await next(); // call the next middleware
Console.WriteLine($"Outgoing: {context.Response.StatusCode}");
});
A reusable convention-based middleware class:
public class RequestLoggingMiddleware
{
private readonly RequestDelegate _next;
public RequestLoggingMiddleware(RequestDelegate next) => _next = next;
public async Task InvokeAsync(HttpContext context)
{
Console.WriteLine($"Request: {context.Request.Method} {context.Request.Path}");
await _next(context); // continue the pipeline
Console.WriteLine($"Response: {context.Response.StatusCode}");
}
}
// Register it in Program.cs
app.UseMiddleware<RequestLoggingMiddleware>();
The class must accept a RequestDelegate in its constructor and expose an InvokeAsync(HttpContext) method that calls _next(context) to continue the chain.
Section B: Short Answer Questions
Attempt any EIGHT questions.
Differentiate between struct and enum in C#.
struct vs enum in C#
| Feature | struct | enum |
|---|---|---|
| Purpose | A lightweight value type that groups related fields, properties and methods | A value type defining a set of named integral constants |
| Members | Can have fields, properties, methods, constructors | Only named constants (no methods/fields) |
| Underlying type | Composite (user-defined layout) | An integral type (default int; can be byte, long, etc.) |
| Use case | Represent small data structures like Point, Date | Represent a fixed list of options like days, states |
| Custom behaviour | Yes (can contain logic) | No (just labelled values) |
Example:
// struct
struct Point
{
public int X, Y;
public Point(int x, int y) { X = x; Y = y; }
}
// enum
enum Day { Sun, Mon, Tue, Wed } // Sun=0, Mon=1, ...
Point p = new Point(2, 3);
Day today = Day.Mon;
Both are value types stored on the stack (when local), but a struct models complex data with behaviour, whereas an enum simply gives readable names to constant integer values.
Explain exception handling in C# with an example.
Exception Handling in C#
An exception is a runtime error that disrupts the normal flow of a program. C# handles exceptions using the try–catch–finally construct:
try— encloses code that might throw an exception.catch— handles a specific exception type; multiple catch blocks can be ordered from most specific to most general.finally— always executes (whether or not an exception occurred), used for cleanup such as closing files/connections.throw— raises an exception explicitly.
Example
try
{
int a = 10, b = 0;
int result = a / b; // throws DivideByZeroException
Console.WriteLine(result);
}
catch (DivideByZeroException ex)
{
Console.WriteLine("Cannot divide by zero: " + ex.Message);
}
catch (Exception ex) // general fallback
{
Console.WriteLine("Error: " + ex.Message);
}
finally
{
Console.WriteLine("Cleanup done.");
}
Output:
Cannot divide by zero: Attempted to divide by zero.
Cleanup done.
All exceptions derive from System.Exception. Custom exceptions can be created by inheriting from Exception.
Differentiate between Entity Framework and ADO.NET.
Entity Framework vs ADO.NET
| Feature | Entity Framework (EF) | ADO.NET |
|---|---|---|
| Type | ORM (Object-Relational Mapper), built on top of ADO.NET | Low-level data access technology |
| Abstraction | High — works with entities/objects (LINQ) | Low — works with raw SQL, Connection, Command, DataReader |
| SQL writing | Generated automatically by EF | Written manually by the developer |
| Mapping | Automatic mapping between tables and C# classes | Manual mapping of columns to objects |
| Productivity | Faster development, less code | More code, more control |
| Performance | Slight overhead due to abstraction | Generally faster, fine-grained control |
| Change tracking | Built-in | Must be coded manually |
Example (EF):
var users = context.Users.Where(u => u.Age > 18).ToList();
Example (ADO.NET):
using var con = new SqlConnection(cs);
con.Open();
var cmd = new SqlCommand("SELECT * FROM Users WHERE Age > 18", con);
var reader = cmd.ExecuteReader();
Summary: EF raises the abstraction level for productivity and maintainability, while ADO.NET gives maximum control and performance at the cost of more manual code. EF internally uses ADO.NET.
Explain the procedure to build, run and deploy an ASP.NET Core application.
Building, Running and Deploying an ASP.NET Core Application
1. Build
Compiles source code into assemblies (DLLs). Using the .NET CLI:
dotnet build
This restores NuGet packages, compiles the project, and produces output in the bin/ folder.
2. Run
Launches the application using the built-in Kestrel web server:
dotnet run
The app listens on a configured port (e.g. https://localhost:5001). During development this enables hot reload and the development environment.
3. Publish (prepare for deployment)
Produces a self-contained, optimized set of files ready to host:
dotnet publish -c Release -o ./publish
The Release configuration optimizes the build; -o specifies the output folder containing the app DLL, dependencies, and static assets.
4. Deploy
The published output can be hosted by:
- IIS on Windows (using the ASP.NET Core Module as a reverse proxy to Kestrel),
- Linux behind Nginx/Apache as a reverse proxy, running as a service,
- Docker container, or
- Cloud platforms such as Azure App Service / AWS.
Deployment can be framework-dependent (target machine needs the .NET runtime) or self-contained (the runtime is bundled with the app).
What are validation controls? Explain client-side validation in ASP.NET Core.
Validation Controls
Validation controls are mechanisms that ensure user-submitted data meets defined rules (required, format, range, length) before it is processed. In ASP.NET Core, validation is primarily done using Data Annotation attributes on model properties, which drive both server-side and client-side validation.
public class User
{
[Required(ErrorMessage = "Name is required")]
public string Name { get; set; }
[EmailAddress]
public string Email { get; set; }
[Range(18, 60)]
public int Age { get; set; }
}
Common attributes: [Required], [StringLength], [Range], [EmailAddress], [RegularExpression], [Compare].
Client-side Validation in ASP.NET Core
Client-side validation runs in the browser before the form is submitted, giving instant feedback and reducing server round-trips. ASP.NET Core enables it through:
- Tag helpers that emit
data-val-*HTML attributes from the model's data annotations:<input asp-for="Email" /> <span asp-validation-for="Email"></span> - jQuery Unobtrusive Validation libraries (
jquery.validate.jsandjquery.validate.unobtrusive.js) that read thosedata-valattributes and validate fields on the client.<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script> <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
Note: Client-side validation improves UX but is not a security boundary — server-side validation (ModelState.IsValid) must always also be performed because client checks can be bypassed.
Explain the role of the appsettings.json and configuration in ASP.NET Core.
appsettings.json and Configuration in ASP.NET Core
appsettings.json is the primary configuration file of an ASP.NET Core application. It stores application settings — such as connection strings, logging levels, and custom options — as JSON key-value pairs, keeping them out of the source code so they can be changed without recompiling.
{
"ConnectionStrings": {
"Default": "Server=.;Database=App;Trusted_Connection=True;"
},
"Logging": { "LogLevel": { "Default": "Information" } },
"AppSettings": { "SiteName": "Kekkei" }
}
The Configuration System
ASP.NET Core builds configuration from multiple layered providers, read in order so that later sources override earlier ones:
appsettings.jsonappsettings.{Environment}.json(e.g.appsettings.Development.json)- Environment variables
- Command-line arguments
- User secrets (development)
All values are exposed through the IConfiguration interface.
Accessing configuration
string cs = builder.Configuration.GetConnectionString("Default");
string name = builder.Configuration["AppSettings:SiteName"];
Strongly-typed via the Options pattern
builder.Services.Configure<AppSettings>(
builder.Configuration.GetSection("AppSettings"));
// inject IOptions<AppSettings> where needed
Role summary: appsettings.json centralizes environment-specific settings; the configuration system merges all providers and makes them available throughout the app via IConfiguration and the Options pattern.
What is a ViewModel? How does it differ from a model?
ViewModel
A ViewModel is a class designed specifically to carry data between a controller and a view. It contains exactly the data (and shape) a particular view needs — often combining fields from several domain models, plus presentation-only properties (dropdown lists, formatted text, validation messages).
public class UserDashboardViewModel
{
public string FullName { get; set; } // from User model
public int OrderCount { get; set; } // from Order model
public List<string> RecentItems { get; set; } // presentation data
}
Model vs ViewModel
| Aspect | Model | ViewModel |
|---|---|---|
| Purpose | Represents domain/business data and maps to the database (entity) | Shapes data specifically for a view |
| Scope | Used across the whole application/data layer | Used only by a particular view |
| Content | Mirrors a database table | May aggregate multiple models + UI-only fields |
| Coupling | Tied to persistence | Decoupled from the database |
Why use a ViewModel?
- Avoids exposing the full entity (security/over-posting).
- Lets a view show data from multiple sources in one object.
- Keeps view-specific validation/formatting separate from domain models, improving maintainability.
Explain the Startup class and the Program.cs in ASP.NET Core.
Program.cs and the Startup Class in ASP.NET Core
Program.cs
Program.cs is the entry point of an ASP.NET Core application. It creates the web application host, configures services (DI) and the middleware pipeline, and starts the server.
In the modern minimal hosting model (.NET 6+), the separate Startup class is merged into Program.cs:
var builder = WebApplication.CreateBuilder(args);
// ---- Service registration (was ConfigureServices) ----
builder.Services.AddControllersWithViews();
builder.Services.AddScoped<IMessageService, EmailService>();
var app = builder.Build();
// ---- Middleware pipeline (was Configure) ----
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllers();
app.Run(); // starts the application
The Startup Class (classic model, .NET Core 3.x / 5)
Before .NET 6, configuration lived in a Startup class with two key methods:
ConfigureServices(IServiceCollection services)— registers services with the DI container.Configure(IApplicationBuilder app, IWebHostEnvironment env)— builds the middleware request pipeline.
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(e => e.MapControllers());
}
}
Summary: Program.cs bootstraps and runs the app; the Startup class (or its equivalent inline code in Program.cs) configures services and the middleware pipeline.
What are tag helpers? Give two examples.
Tag Helpers
Tag Helpers are server-side components in ASP.NET Core that enable C#/server-side logic to participate in creating and rendering HTML elements within Razor views. They look like ordinary HTML attributes (prefixed conventions such as asp-*), making markup cleaner and more HTML-friendly than the older Razor @Html helper syntax, while still being strongly typed and IntelliSense-friendly.
They are enabled in _ViewImports.cshtml:
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Two Examples
1. Anchor Tag Helper (asp-controller, asp-action) — generates URLs from routing:
<a asp-controller="Home" asp-action="Index">Home</a>
<!-- renders: <a href="/Home/Index">Home</a> -->
2. Form / Input Tag Helpers (asp-for) — binds an input to a model property and emits validation attributes:
<form asp-action="Save" method="post">
<input asp-for="Email" />
<span asp-validation-for="Email"></span>
<button type="submit">Save</button>
</form>
Other common tag helpers include asp-validation-summary, asp-route-*, the Label, Image (asp-append-version), and Environment tag helpers.
Frequently asked questions
- Where can I find the BSc CSIT (TU) NET Centric Computing (BSc CSIT, CSC367) question paper 2079?
- The full BSc CSIT (TU) NET Centric Computing (BSc CSIT, CSC367) 2079 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
- Does the NET Centric Computing (BSc CSIT, CSC367) 2079 paper come with solutions?
- Yes. Every question on this NET Centric Computing (BSc CSIT, CSC367) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
- How many marks is the BSc CSIT (TU) NET Centric Computing (BSc CSIT, CSC367) 2079 paper?
- The BSc CSIT (TU) NET Centric Computing (BSc CSIT, CSC367) 2079 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
- Is practising this NET Centric Computing (BSc CSIT, CSC367) past paper free?
- Yes — reading and attempting this NET Centric Computing (BSc CSIT, CSC367) past paper on Kekkei is completely free.