NEB Class 12 Science Visual Programming Question Paper 2082 (Set D) Nepal
This is the official NEB Class 12 (Science stream) Visual Programming question paper for 2082 Set D, as set in the regular annual examination. It carries 50 full marks and a time allowance of 120 minutes, across 16 questions. On Kekkei you can attempt this Visual Programming 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 NEB Class 12 Visual Programming exam or solving previous years' question papers, this 2082 paper is a great way to practise under real exam conditions.
Group 'A'
Rewrite the correct option of each question in your answer sheet.
What does C# stand for in C#.NET ?
C-Sharp
C# stands for C-Sharp.
'Implicit Conversion' follows the order of conversion as per compatibility of data type as :
char < int < float
Implicit conversion widens from smaller to larger type: char < int < float.
What will be the output of following program ?
for (int i = 0; i<5; i++){
if (i == 2)
continue;
console.Write (i+ " ");
}
0 1 3 4
The loop runs for i = 0 to 4. When i == 2, continue skips the Write, so 2 is not printed. Output: 0 1 3 4.
Which of the following represents a two dimensional array in C# ?
int[, ] arr = new int [2, 3];
A 2D array in C# is declared with a comma inside the brackets: int[,] arr = new int[2, 3];.
When does a structure variable get destroyed ?
As variable goes out of the scope
A struct is a value type allocated (typically) on the stack; it is destroyed when the variable goes out of scope.
Which of the following would be best implemented using a struct instead of a class in C# ?
Representing a 2D coordinate point (x, y) in a graphics application.
A small, lightweight value type with a couple of fields suits a struct best: representing a 2D coordinate point (x, y) in a graphics application.
In C#, structure is used to define :
A collection of variables of different type.
A structure groups together related variables, which may be of different types: a collection of variables of different type.
Among the given pointer which of the following cannot be incremented ?
void
A void pointer has no associated type/size, so pointer arithmetic (incrementing) is not allowed on it: void.
In C#, which method is used to execute an SQL INSERT query to add a new record to a database ?
ExecuteNonQuery( )
INSERT/UPDATE/DELETE statements that do not return rows are run with ExecuteNonQuery().
Group 'B'
Short Answer Questions
What do you mean by operator in C# ? Explain any two types with example. [1+4]
An operator is a special symbol that tells the compiler to perform a specific mathematical, relational, logical or bitwise operation on one or more operands (values/variables) and produce a result.
Two types:
- Arithmetic operators — perform basic mathematical operations (
+,-,*,/,%).
int a = 10, b = 3;
Console.WriteLine(a + b); // 13 (addition)
Console.WriteLine(a % b); // 1 (modulus / remainder)
- Relational (comparison) operators — compare two operands and return a
bool(==,!=,>,<,>=,<=).
int x = 5, y = 8;
Console.WriteLine(x < y); // True
Console.WriteLine(x == y); // False
(Other valid pairs: logical &&, ||, !; assignment =, +=; etc.)
In C# application, you need to manage test scores for 30 students. How would you initialize array with scores, update the score of 10th student, and then display the score of all students.
Or
Write a C# program to add two matrices and display the sum.
Option 1 — 30 student scores (1D array):
using System;
class Scores {
static void Main() {
int[] scores = new int[30]; // initialize array for 30 students
for (int i = 0; i < 30; i++)
scores[i] = i + 1; // sample initialization
scores[9] = 95; // update 10th student (index 9)
for (int i = 0; i < scores.Length; i++)
Console.WriteLine("Student " + (i + 1) + ": " + scores[i]);
}
}
Option 2 — add two 2×2 matrices:
using System;
class MatrixAdd {
static void Main() {
int[,] a = { {1, 2}, {3, 4} };
int[,] b = { {5, 6}, {7, 8} };
int[,] sum = new int[2, 2];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
sum[i, j] = a[i, j] + b[i, j];
Console.WriteLine("Sum of matrices:");
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
Console.Write(sum[i, j] + " ");
Console.WriteLine();
}
}
}
Compare one-dimensional array and two-dimensional array in C#.
Or
Explain IndexOf( ) and compare any two string functions with examples in C#. [2+3]
Option 1 — 1D vs 2D array:
| One-dimensional array | Two-dimensional array |
|---|---|
| Stores elements in a single row (linear list). | Stores elements in rows and columns (table/matrix). |
Declared as int[] a = new int[5]; | Declared as int[,] a = new int[2,3]; |
Accessed with a single index a[i]. | Accessed with two indices a[i, j]. |
| Represents a list of values. | Represents a grid/matrix of values. |
Option 2 — IndexOf() and two string functions:
IndexOf()returns the zero-based position of the first occurrence of a specified character or substring; returns-1if not found.
string s = "Programming";
Console.WriteLine(s.IndexOf('g')); // 3
Console.WriteLine(s.IndexOf("ram")); // 4
Comparing two other string functions:
Substring(start, length)— extracts a portion of the string.
Console.WriteLine("Programming".Substring(0, 4)); // "Prog"
ToUpper()— returns a copy of the string in upper case.
Console.WriteLine("Programming".ToUpper()); // "PROGRAMMING"
Substring() returns part of a string while ToUpper() changes the casing of the whole string; both return a new string without modifying the original (strings are immutable).
Define structure in C#. Write a C# program to define a structure called a 'Book' that contains the following field : Title, Author and Price. Create an instance of the structure, assign values to the fields, and display them. [1+4]
A structure (struct) in C# is a value type that groups together related variables (fields) of different data types under a single name. Unlike a class, it is stored on the stack and is suited to small, lightweight data objects.
using System;
struct Book {
public string Title;
public string Author;
public double Price;
}
class Program {
static void Main() {
Book b; // create an instance
b.Title = "C# Programming"; // assign values
b.Author = "John Doe";
b.Price = 550.0;
Console.WriteLine("Title : " + b.Title);
Console.WriteLine("Author: " + b.Author);
Console.WriteLine("Price : " + b.Price);
}
}
Explain the advantages of using pointer in C#. In which scenario they should be used ? [2+3]
Advantages of using pointers in C#:
- Direct memory access — a pointer holds the actual memory address of a variable, allowing direct read/write of that location.
- Performance / efficiency — avoids copying large data structures by passing addresses, reducing overhead.
- Interoperability — enables calling unmanaged/native (C/C++ Win32) APIs that expect raw memory addresses.
- Low-level manipulation — supports pointer arithmetic and working with fixed memory buffers.
Scenarios where pointers should be used (inside an unsafe block):
- Interoperating with unmanaged code / native libraries (P/Invoke, COM).
- Performance-critical code such as image/audio/byte-buffer processing where copying must be avoided.
- Working with fixed-size memory buffers or hardware/device-level programming.
Note: pointers in C# require the unsafe keyword and the /unsafe compiler option, and should be used only when managed alternatives are insufficient.
Group 'C'
Long Answer Questions
Explain different types of conditional control statement in C# with their syntax, functionality and provide real world example for each.
Conditional control statements let a program choose different paths of execution based on whether a condition is true or false.
1. if statement — executes a block only when the condition is true.
if (condition) {
// statements
}
Real-world: allow login only if the password is correct.
if (password == "admin123")
Console.WriteLine("Login successful");
2. if...else statement — chooses between two blocks.
if (condition) {
// true block
} else {
// false block
}
Real-world: decide pass or fail by marks.
if (marks >= 40)
Console.WriteLine("Pass");
else
Console.WriteLine("Fail");
3. if...else if...else (ladder) — tests several conditions in sequence.
if (cond1) { ... }
else if (cond2) { ... }
else { ... }
Real-world: assign grade by marks.
if (marks >= 80) Console.WriteLine("A");
else if (marks >= 60) Console.WriteLine("B");
else if (marks >= 40) Console.WriteLine("C");
else Console.WriteLine("Fail");
4. Nested if — an if placed inside another if for dependent conditions.
if (age >= 18) {
if (hasLicense)
Console.WriteLine("Allowed to drive");
}
Real-world: a person can drive only if both adult and licensed.
5. switch statement — selects one of many blocks based on the value of an expression.
switch (expression) {
case value1: ...; break;
case value2: ...; break;
default: ...; break;
}
Real-world: menu selection.
switch (day) {
case 1: Console.WriteLine("Sunday"); break;
case 2: Console.WriteLine("Monday"); break;
default: Console.WriteLine("Invalid"); break;
}
Thus C# provides if, if-else, if-else if ladder, nested if, and switch as conditional control statements.
What are the steps required to establish a connection between a C# program and a database ? Explain with example.
Or
Explain any four methods in array class with program in C#.
Option 1 — Steps to connect a C# program to a database (ADO.NET):
- Add the namespace —
using System.Data.SqlClient;(for SQL Server). - Create a connection string with server, database and authentication details.
- Create a
SqlConnectionobject using the connection string. - Open the connection with
con.Open(). - Create a command (
SqlCommand) with the SQL query and connection. - Execute the command —
ExecuteNonQuery()for INSERT/UPDATE/DELETE,ExecuteReader()for SELECT. - Process the result (read rows if any).
- Close the connection with
con.Close().
using System;
using System.Data.SqlClient;
class DbDemo {
static void Main() {
string cs = "server=.;database=SchoolDB;Trusted_Connection=True;";
SqlConnection con = new SqlConnection(cs);
con.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO Student VALUES('Ram', 85)", con);
int rows = cmd.ExecuteNonQuery();
Console.WriteLine(rows + " record inserted");
con.Close();
}
}
Option 2 — Four methods of the Array class with program:
Array.Sort()— sorts elements in ascending order.Array.Reverse()— reverses the order of elements.Array.IndexOf()— returns the index of a given value.Array.Clear()— sets a range of elements to their default value (0/null).
using System;
class ArrayMethods {
static void Main() {
int[] a = { 40, 10, 30, 20 };
Array.Sort(a); // 10 20 30 40
Console.WriteLine(string.Join(" ", a));
Array.Reverse(a); // 40 30 20 10
Console.WriteLine(string.Join(" ", a));
int pos = Array.IndexOf(a, 20); // index of value 20
Console.WriteLine("Index of 20: " + pos);
Array.Clear(a, 0, 2); // first two set to 0
Console.WriteLine(string.Join(" ", a));
}
}
(Other valid Array methods: Array.Copy(), Array.Find(), Array.Length.)
Frequently asked questions
- Where can I find the NEB Class 12 Visual Programming question paper 2082?
- The full NEB Class 12 Visual Programming 2082 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
- Does the Visual Programming 2082 paper come with solutions?
- Yes. Every question on this Visual Programming past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
- How many marks is the NEB Class 12 Visual Programming 2082 paper?
- The NEB Class 12 Visual Programming 2082 paper carries 50 full marks and is meant to be completed in 120 minutes, across 16 questions.
- Is practising this Visual Programming past paper free?
- Yes — reading and attempting this Visual Programming past paper on Kekkei is completely free.