INDEX NUMBER
LANKA NIPPON BIZTECH INSTITUTE
FINAL EXAMINATION
Department Computing
Course Bachelor of Science Honors in SE
Module Code IT21033
Module Name Visual Application Programming
Year of Study
Academic Year Year 2
Semester Semester 1
Date of the Examination
Time of the Examination
Duration
Maximum marks for
final grade
Instructions to Candidates
1. This paper contains 05 questions on 06 pages (from page 2 to 6).
2. You should answer ALL questions.
3. Clearly write your index number (do not write your name or student ID) on the
examination booklet, supplementary answer sheets and the question paper.
4. Write your answers in the examination answer booklet provided and all answers to a
new question should start on a new page.
5. Clearly write the question number on the left side margin of the answer sheet.
6. Candidates are not allowed to bring any material other than those allowed by the
invigilator into the examination hall.
Question Paper Code
7. Students are permitted to use black or blue ink pens while writing answers. Correction
pens are not allowed to use.
8. This is a closed book examination.
Question Paper Code
Visual Application Programming Page 1 of 20
Question 1
1. Difference Between Compiler and Interpreter?
[2 marks]
2. Explain the role of the Common Language Runtime (CLR) in the .NET Framework.
[2 marks]
3. What is the purpose of the .NET Framework Class Library (FCL)?
[2 marks]
4. Consider following data set.
5 2 9 4
1 6 7 3
a. Write code segments to store the above data into 2D array.
[2 marks]
b. Write the answer for below methods.
[3 marks]
Visual Application Programming Page 2 of 20
5. What is the output of the given code segment?
[3 marks]
for (int number = 2; number <=50; number++)
{
if (number % 3 == 0 && number / 5==0)
{
continue;
}
else if (number > 20)
{
break;
}
else{ [Link](number
);
}}
6. What is the output of the following Code Segment?
[3 marks]
int r=37, K=31;
int f=K++;
int p=--r%++f;
[Link](“p is {0} f is {1}”,p,f);
[Link](“r is {0}”, r);
7. Write a C# program that prompts the user for a username and password. If the username
is "admin" and the password is "password123," display "Login successful." Otherwise,
display "Login failed.". Use Ternary Conditional Statements to manage the process.
[3 marks]
[Total - 20 Marks]
Visual Application Programming Page 3 of 20
Question 02
1. Write the deference between Enumeration and Structure User Defined Data Types.
[2 Marks]
2. Write a simple C# console application code for the following scenario using Enumeration
User Defined Data Type. Consider you have to store the marks for a viva as status. Then
print the status of the mark on console screen using enumeration user defined value types.
High
Average
Low
a. Implement the Enumeration User Defined Data Type for above example.
[3 marks]
b. Declare three variables and initialize these their variable using above
Enumeration User Defined Data Type values.
[3 marks]
Visual Application Programming Page 4 of 20
3. Write a simple C# console application code for the following scenario using Structure
User Defined Data Type. You have to write a C# console program to get player
records in a cricket match as user inputs. Use structure user define type.
Example Output
Enter Player Name : Donald Bradman
Enter Score : 114
Enter Balls faced: 215
a. Implement the structure User Defined Data Type for above example.
[3 marks]
b. Declare variables and initialize their values using get the user input as mention in
above example output.
[3 marks]
Visual Application Programming Page 5 of 20
Visual Application Programming Page 6 of 20
4. Write a C# Program that will take unit of fluid Liter as a user input. The program
should convert liter unit into ounce unit.
[6 marks]
Hint: 1 Liter = 35.1951 ounce
Note: Round your answer to two decimal places.
Example:
o Enter Volume in gallon:25
o Sample Output:
o 20 Liter in ounce equal to 879.877
o Rounded Answer is 879.88 ounce
Visual Application Programming Page 7 of 20
[Total – 20 Marks]
Visual Application Programming Page 8 of 20
Question 03
In object-oriented programming, a class is a user-defined blueprint or prototype from which
objects are created.
1. Define the class student in C# to represent the below student class given in below
picture. In [+] represent the public attribute. Also providing function signature is only
sufficient.
[ 4 marks]
Student
+Student ID: String
+ Name: String
+Age: Integer
+Address: String
+Contact Number: Integer
-Email: String
+ Change_ContactDetail ( );
+Print_Student ();
Visual Application Programming Page 9 of 20
2. Write a constructor method to initialize the two attribute Name and Age.
[2 Marks]
3. Compare and Constructor difference between constructor method and destructor
method. Write at least two point.
[4 marks]
4. The syntactically distinction between structure and class in C# s minimal. Justify
this statement with providing proper example.
[4 marks]
5. Write a code segment to print student name and age. and by creating student object
call the print method in main method.
[3 marks]
Visual Application Programming Page 10 of 20
6. What is the difference between Label, Textbox, and Button controls in Windows Forms?
[3 marks]
Visual Application Programming Page 11 of 20
[Total – 20 Marks]
Question 04.
Refer this online payment system that supports multiple payment methods, such as Credit Card
and PayPal. The system should include an abstract class, interfaces, and concrete classes to
manage different payment methods.
- Abstract Class (Payment):
Attributes are Amount and Currency.
abstract method ProcessPayment ()
- Interface 1 (ISecurePayment):
method ValidateSecurity ()
- Interface 2 (IRefundable):
Method IssueRefund ()
- Concrete Class 1 (CreditCardPayment):
Attributes: Card Number, Cardholder Name.
1. Implement the Payment abstract class.
[3 marks]
2. implement the ISecurePayment and IRefundable interfaces.
Visual Application Programming Page 12 of 20
[4 Marks]
3. Create a concrete class CreditCardPayment that inherits from the Payment abstract class
and implements the ISecurePayment and IRefundable interfaces.
[3 marks]
4. Implement the ProcessPayment (), ValidateSecurity (), and IssueRefund () methods with
just print statement is sufficient.
Visual Application Programming Page 13 of 20
[6 marks: 2 marks for each and every method]
5. Write an example for runtime polymorphism and Compile time polymorphism. methods
with just print statement is sufficient.
[4 marks: 2 marks for each]
Visual Application Programming Page 14 of 20
[Total – 20 Marks]
Visual Application Programming Page 15 of 20
Question 05
01. Explain the difference between catch and finally blocks in exception handling.
[2 Marks]
02. What is an exception in C#? Explain with an example of how to handle a “Array
Index Out of Bound Exception”.
[3 marks]
Visual Application Programming Page 16 of 20
03. Write a C# program that includes a try-catch block to handle an exception when
attempting to convert a string to an integer. If the conversion fails, the program
should display an appropriate error message.
[3 marks]
Visual Application Programming Page 17 of 20
04. Write a C# program that reads a number from the user and then divides 100 by that
number. Include exception handling to manage both DivideByZeroException and
Format Exception.
[4 marks]
Visual Application Programming Page 18 of 20
05. Write a C# program to validate a date string in the format mm/dd/yyyy, ensuring that:
a. dd is a valid day (01-31).
[2 marks]
b. mm is a valid month (01-12).
[2 marks]
c. yyyy is a valid year.
[2 marks]
d. Write a regular expression for the date format by combining the three expressions
above, using appropriate symbols.
[2 marks]
[Total – 20 Marks]
Visual Application Programming Page 19 of 20
END OF QUESTION PAPER.
Visual Application Programming Page 20 of 20