Browse papers
A

Group 'A'

Rewrite the correct option of each question in your answer sheet.

9 questions·1 marks each
1mcq1 marks

What does C# stand for in C#.NET ?

  • A

    C-Sharp

  • B

    C- Simple

  • C

    C-Structure

  • D

    C-Secure

Correct answer: A

C-Sharp

C# stands for C-Sharp.

csharpdotnet
2mcq1 marks

'Implicit Conversion' follows the order of conversion as per compatibility of data type as :

  • A

    float < char < int

  • B

    char < int < float

  • C

    int < char < float

  • D

    float < int < char

Correct answer: B

char < int < float

Implicit conversion widens from smaller to larger type: char < int < float.

csharptype-conversion
3mcq1 marks

What will be the output of following program ?

for (int i = 0; i<5; i++){
    if (i == 2)
        continue;
    console.Write (i+ " ");
}
  • A

    0 1 3 4

  • B

    0 1 2 3 4

  • C

    0 1 4

  • D

    Compilation Error

Correct answer: A

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.

csharploopscontrol-flow
4mcq1 marks

Which of the following represents a two dimensional array in C# ?

  • A

    int[, ] arr = new int [2, 3];

  • B

    int [ ] [ ] arr = new int [2, 3];

  • C

    int[ ] arr = new int [2, 3];

  • D

    int[2, 3] arr = new int [ ];

Correct answer: A

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];.

csharparrays
5mcq1 marks

When does a structure variable get destroyed ?

  • A

    When no reference refers to it, it will get garbage collected.

  • B

    Depends on whether it is created using new or without new operator.

  • C

    As variable goes out of the scope

  • D

    Depends on either we free its memory using free( ) or delete( ).

Correct answer: C

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.

csharpstructsmemory
6mcq1 marks

Which of the following would be best implemented using a struct instead of a class in C# ?

  • A

    Storing student's academic record, including subject and grades.

  • B

    Representing a 2D coordinate point (x, y) in a graphics application.

  • C

    Managing a list of employees with different job.

  • D

    Implementing a complex inventory system for online user.

Correct answer: B

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.

csharpstructsvalue-types
7mcq1 marks

In C#, structure is used to define :

  • A

    A datatype that can hold a single value.

  • B

    A collection of variables of different type.

  • C

    A collection of methods

  • D

    A collection of properties

Correct answer: B

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.

csharpstructs
8mcq1 marks

Among the given pointer which of the following cannot be incremented ?

  • A

    int

  • B

    char

  • C

    float

  • D

    void

Correct answer: D

void

A void pointer has no associated type/size, so pointer arithmetic (incrementing) is not allowed on it: void.

csharppointers
9mcq1 marks

In C#, which method is used to execute an SQL INSERT query to add a new record to a database ?

  • A

    ExecuteQuery( )

  • B

    ExecuteNonQuery( )

  • C

    ExecuteReader( )

  • D

    ExecuteScalar( )

Correct answer: B

ExecuteNonQuery( )

INSERT/UPDATE/DELETE statements that do not return rows are run with ExecuteNonQuery().

csharpdatabaseado-net
B

Group 'B'

Short Answer Questions

5 questions·5 marks each
10short5 marks

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:

  1. Arithmetic operators — perform basic mathematical operations (+, -, *, /, %).
int a = 10, b = 3;
Console.WriteLine(a + b);  // 13 (addition)
Console.WriteLine(a % b);  // 1  (modulus / remainder)
  1. 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.)

csharpoperators
11short5 marks

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 2times22\\times2 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();
        }
    }
}
csharparraysmatrix
12short5 marks

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 arrayTwo-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 -1 if 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).

csharparraysstrings
13short5 marks

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);
    }
}
csharpstructs
14short5 marks

Explain the advantages of using pointer in C#. In which scenario they should be used ? [2+3]

Advantages of using pointers in C#:

  1. Direct memory access — a pointer holds the actual memory address of a variable, allowing direct read/write of that location.
  2. Performance / efficiency — avoids copying large data structures by passing addresses, reducing overhead.
  3. Interoperability — enables calling unmanaged/native (C/C++ Win32) APIs that expect raw memory addresses.
  4. 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.

csharppointers
C

Group 'C'

Long Answer Questions

2 questions·8 marks each
15long8 marks

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.

csharpcontrol-flowconditional-statements
16long8 marks

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):

  1. Add the namespaceusing System.Data.SqlClient; (for SQL Server).
  2. Create a connection string with server, database and authentication details.
  3. Create a SqlConnection object using the connection string.
  4. Open the connection with con.Open().
  5. Create a command (SqlCommand) with the SQL query and connection.
  6. Execute the commandExecuteNonQuery() for INSERT/UPDATE/DELETE, ExecuteReader() for SELECT.
  7. Process the result (read rows if any).
  8. 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.)

csharpdatabaseado-netarrays

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.