Solved T.Y. B.B.A. (Computer Application) CA-604: DOT NET FRAMEWORK (2019 Pattern) Exam Paper
Q1) Attempt any Eight of the following (out of ten)
a) What is IDE?
An Integrated Development Environment (IDE) is a software application that provides comprehensive facilities for software development. It typically consists of a source code editor, build automation tools, a debugger, and other tools to help developers write, test, and debug their code. Examples include Visual Studio, Eclipse, and IntelliJ IDEA.
b) What is CLS?
The Common Language Specification (CLS) is a set of rules and guidelines that define the basic features of a language that are understood by all .NET languages. It ensures interoperability between different .NET languages (like C#, VB.NET, and F#). CLS ensures that components written in different languages can interact seamlessly with each other.
c) Explain Timer control in vb.net?
The Timer control in VB.NET is used to execute code at specified intervals. It runs in the background and raises an event at each time interval. It is often used to perform tasks like updating the user interface or performing recurring actions. The Timer control is typically set with an interval in milliseconds and the Tick
event is used to define what actions should be performed when the timer elapses.
d) Explain JIT compilers?
The Just-In-Time (JIT) compiler in .NET is responsible for converting the intermediate language (IL) code of a .NET program into native machine code at runtime. It does this just before the method is called for the first time. JIT helps to improve performance because it only compiles the necessary code when it is required.
e) Explain class and object in C#?
- Class: A class in C# is a blueprint for creating objects. It defines the properties (fields) and behaviors (methods) that the objects created from the class will have.
- Object: An object is an instance of a class. It contains the actual values for the properties defined in the class and can call the methods defined in the class.
Example:
public class Car {
public string model;
public void Drive() {
Console.WriteLine("Driving the car.");
}
}
Car myCar = new Car(); // Object
myCar.model = "Toyota";
myCar.Drive();
f) What is method overloading in C#?
Method overloading in C# refers to defining multiple methods with the same name but different parameters. The method signature differs by the number or type of arguments. The correct method is chosen based on the arguments passed when the method is called.
Example:
public class Calculator {
public int Add(int a, int b) {
return a + b;
}
public double Add(double a, double b) {
return a + b;
}
}
g) Explain ADO.net?
ADO.NET (Active Data Objects) is a set of libraries in .NET that allows interaction with databases. It provides classes to connect to databases, retrieve data, and manipulate it. The key components of ADO.NET are:
- Connection: Establishes a connection to a data source (e.g., SQL Server).
- Command: Executes queries or stored procedures against the database.
- DataReader: Provides a forward-only, read-only cursor for data.
- DataSet: An in-memory cache of data retrieved from the database.
h) Explain the Range validator?
The RangeValidator control in ASP.NET is used to ensure that the value entered in a user input field falls within a specified range. It can be used with text boxes, and it validates whether the input is within a specific minimum and maximum value.
Example:
<asp:RangeValidator
ID="RangeValidator1"
runat="server"
ControlToValidate="TextBox1"
MinimumValue="1"
MaximumValue="100"
Type="Integer"
ErrorMessage="Enter a value between 1 and 100" />
i) What is ASP.NET?
ASP.NET is a framework developed by Microsoft for building dynamic web applications. It allows developers to create web pages, web services, and websites using various programming languages like C# and VB.NET. ASP.NET provides robust features such as server-side scripting, data handling, and application security.
j) Enlist any Two Form controls in VB.NET
TextBox Control: This control is used to accept input from user or to display text.
Label Control: Label control is used to display text on the client area of form such as title, paragraph or captions for other control.
Looking for more practice? Check out our complete collection of solved Dot Net Framework exam papers
Q2) Attempt any Four of the following (explain in detail)
a) What are control structures? Discuss any two control structures.
Control structures are used to determine the flow of execution in a program based on certain conditions. They allow you to control whether a block of code runs or not.
Two control structures:
- If-Else: Used to make decisions in a program. It checks a condition and executes one block of code if true, or another block if false.
if (x > 10) { Console.WriteLine("Greater"); } else { Console.WriteLine("Smaller"); }
- For Loop: Used to repeat a block of code a specific number of times.
for (int i = 0; i < 5; i++) { Console.WriteLine(i); }
b) Explain components of .NET framework.
The .NET Framework consists of several key components:
- Common Language Runtime (CLR): The runtime engine responsible for executing .NET applications.
- Base Class Library (BCL): A set of classes that provide basic functionality (file handling, data structures, networking, etc.).
- ASP.NET: A framework for building web applications.
- ADO.NET: A set of libraries for database access and manipulation.
- Windows Forms: A set of libraries for building desktop applications.
c) Explain Inheritance with example?
Inheritance is an object-oriented programming concept where a class can inherit properties and methods from another class. The new class (derived class) can reuse, extend, or modify the behavior of the existing class (base class).
Example:
public class Animal {
public void Speak() {
Console.WriteLine("Animal speaks");
}
}
public class Dog : Animal {
public void Bark() {
Console.WriteLine("Dog barks");
}
}
Dog dog = new Dog();
dog.Speak(); // Inherited method
dog.Bark(); // Method in derived class
d) Explain Server control.
Server controls in ASP.NET are controls that are processed on the server side. These controls include form elements like buttons, text boxes, labels, and more, which are rendered as HTML and sent to the client browser. Server controls are capable of handling events and maintaining state between requests.
e) Explain command object?
The Command object in ADO.NET is used to execute SQL queries or stored procedures against a database. It contains the SQL command or stored procedure name, and it can also be used to retrieve results.
Q3) Attempt any Four of the following (explain in detail)
a) Write a VB.net program for blinking an image.
Imports System.Threading
Public Class Form1
Dim WithEvents Timer1 As New Timer()
Dim img As PictureBox
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
img = New PictureBox()
img.Image = Image.FromFile("path_to_image.jpg")
img.Visible = True
Me.Controls.Add(img)
Timer1.Interval = 500 ' 500ms
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
img.Visible = Not img.Visible
End Sub
End Class
b) Write a program in C# swapping two numbers.
using System;
class Program {
static void Main() {
int a = 5, b = 10;
Console.WriteLine("Before Swap: a = {0}, b = {1}", a, b);
// Swap
int temp = a;
a = b;
b = temp;
Console.WriteLine("After Swap: a = {0}, b = {1}", a, b);
}
}
c) Design a VB.net form to pick a date from DateTimePicker control and display day, month, and year in separate textboxes.
Public Class Form1
Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
TextBox1.Text = DateTimePicker1.Value.Day.ToString()
TextBox2.Text = DateTimePicker1.Value.Month.ToString()
TextBox3.Text = DateTimePicker1.Value.Year.ToString()
End Sub
End Class
d) Write a VB.net program to check whether the entered string is palindrome or not.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim str As String = TextBox1.Text
Dim reversed As String = StrReverse(str)
If str = reversed Then
MessageBox.Show("Palindrome")
Else
MessageBox.Show("Not a Palindrome")
End If
End Sub
End Class
e) Write a C# application to display the vowels from a given string.
using System;
class Program {
static void Main() {
string input = "Hello World";
string vowels = "AEIOUaeiou";
foreach (char c in input) {
if (vowels.Contains(c)) {
Console.WriteLine(c);
}
}
}
}
Q4) Attempt any Four of the following (explain in detail)
a) What are constructors? Explain with suitable Example?
A constructor is a special method in a class that is called when an object of that class is created. It is used to initialize the object’s state.
Example:
public class Person {
public string Name;
public int Age;
// Constructor
public Person(string name, int age) {
Name = name;
Age = age;
}
}
Person p = new Person("John", 30); // Constructor is called
b) Explain connection object and command object.
- Connection Object: It establishes a connection to a data source (e.g., a SQL Server database). It is used to open, close, and manage connections to databases.
- Command Object: It is used to execute queries or stored procedures on the database. It can also fetch data.
c) Write a C# program to find the area of a circle.
using System;
class Program {
static void Main() {
double radius = 5.0;
double area = Math.PI * radius * radius;
Console.WriteLine("Area of circle: " + area);
}
}
d) Write a VB.net program to move the text “Pune university” continuously from left to right.
Public Class Form1
Dim x As Integer = 0
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Label1.Text = "Pune University"
Label1.Left += 5
If Label1.Left > Me.Width Then
Label1.Left = -Label1.Width
End If
End Sub
End Class
e) Write a C# program to accept and display ‘n’ student’s details.
using System;
class Student {
public int RollNo;
public string Name;
public double Marks;
public double GetPercentage() {
return (Marks / 300) * 100;
}
}
class Program {
static void Main() {
int n = 3; // Assume we have 3 students
Student[] students = new Student[n];
for (int i = 0; i < n; i++) {
students[i] = new Student();
Console.WriteLine("Enter Roll No:");
students[i].RollNo = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Name:");
students[i].Name = Console.ReadLine();
Console.WriteLine("Enter Marks:");
students[i].Marks = Convert.ToDouble(Console.ReadLine());
}
foreach (var student in students) {
Console.WriteLine("Roll No: " + student.RollNo);
Console.WriteLine("Name: " + student.Name);
Console.WriteLine("Marks: " + student.Marks);
Console.WriteLine("Percentage: " + student.GetPercentage() + "%");
}
}
}
Q5) Write a short note on Any Two of the following
a) Event Driven Programming
Event-driven programming is a paradigm where the flow of the program is determined by user actions, sensor outputs, or other events. In this model, the program reacts to events like button clicks, mouse movements, or system messages.
b) Object-Oriented Concepts in C#
C# supports object-oriented programming principles such as:
- Encapsulation: The bundling of data and methods that operate on that data.
- Inheritance: A class can inherit from another class to reuse or extend its functionality.
- Polymorphism: Allows methods to behave differently based on the object calling them.
- Abstraction: Hiding the complex implementation details and exposing only the essential features.
c) Validation controls in ASP.NET
Validation controls in ASP.NET are used to validate user inputs before data is submitted to the server. Common validation controls include:
- RequiredFieldValidator: Ensures a field is not empty.
- RangeValidator: Ensures input falls within a specified range.
- RegularExpressionValidator: Validates input using a regular expression.
- CustomValidator: Used to define custom validation logic.