Visual Programming Using C# – Answer
Key (BCA/B.Sc. – June 2024)
PART A – (10 × 2 = 20 marks)
Answer ALL Questions
1. 1. Unique features of C#
C# is object-oriented, modern, type-safe, and has automatic garbage collection. It
supports multi-threading, LINQ, and integration with the .NET Framework.
2. 2. Managed Code
Code that is executed under the control of the CLR (Common Language Runtime) is
called managed code.
3. 3. Local Variable
A variable declared inside a method or block that is accessible only within it.
4. 4. Value Parameter
A parameter that passes a copy of the variable's value to the method.
5. 5. Interface in C#
An interface defines a contract. Classes implement it using ':' and must define all its
methods.
6. 6. Abstract Class
A class that cannot be instantiated and may contain abstract methods without
implementation.
7. 7. Use of Events
Events are used to respond to user actions like clicks, keypresses, etc.
8. 8. Common Dialog Box
Used to open/save files, choose colors or fonts. Examples: OpenFileDialog,
SaveFileDialog.
9. 9. Advantages of DataGridView
Easy to bind, view, and edit tabular data in a Windows Form.
10. 10. Data Binding
Linking UI controls like TextBox or GridView to a data source like a database or dataset.
PART B – (5 × 5 = 25 marks)
Answer ALL Questions – Attempt either (a) or (b) for each question.
11(a). Base Class Library (BCL) provides core functionality like System, System.IO,
System.Net, System.Data, and System.Windows.Forms.
11(b). Metadata stores information about program structure. Assembler converts IL to
machine code (e.g., using ilasm.exe).
12(a). Boxing converts value type to object type; Unboxing extracts the value type from
object.
12(b). Namespaces group related classes. Example: System.IO, System.Collections.
13(a). Inheritance allows a class to use members of another. C# supports single class
inheritance, but multiple interface inheritance.
13(b). Properties are special methods to access private fields. Use get and set accessors.
14(a). Menu creation uses MenuStrip in Windows Forms. Items like File → New/Open are
added with event handlers.
14(b). File IO uses classes like StreamReader/Writer and File.ReadAllText/WriteAllText
from System.IO.
15(a). DataReader provides fast, forward-only, read-only access to data. Example:
SqlDataReader.
15(b). DataAdapter acts as a bridge between DataSet and database. Supports Fill() and
Update() methods.
PART C – (3 × 10 = 30 marks)
Answer ANY THREE Questions
Q16. CLS (Common Language Specification) defines rules for .NET language
interoperability. CTS (Common Type System) standardizes data types across languages.
Q17. Looping in C#: for, while, do-while. Example:
for(int i=0;i<5;i++) { Console.WriteLine(i); }
Q18. Operator Overloading allows redefining operators for user-defined types. Example:
overload '+' for Complex numbers.
Q19. Common Dialog Boxes in C#: OpenFileDialog, SaveFileDialog, ColorDialog, FontDialog.
Used for file operations and UI customization.
Q20. Add, Update, Delete in ADO.NET:
Use SqlCommand with INSERT, UPDATE, DELETE statements and ExecuteNonQuery().
Requires SqlConnection.