Computer Application Semester 2 Sample Paper 1
Computer Application Semester 2 Sample Paper 1
(vi) Variable that is associated with the objects of a class is called _______________.
(a) Instance variable (b) class variable (c) Local variable (d) Argument variable
(x) Visible in the classes and subclasses in the same package and subclasses in other packages.
(a) private (b) public (c) protected (d) default
Question 2
Define a class to accept two strings, convert them into uppercase, check and display whether two strings
are equal in length or not, if the two strings are not equal in length, print the larger and the smaller string
with proper messages or print the message both the strings are of equal length.
Question 3
Define a class to declare a String array of size N and accept N full names of persons into the array.
Accept a surname from the user and display all the names whose surname matches with the entered
surname if any match is found, otherwise display the message “NO NAMES WITH THE <SURNAME>
FOUND”.
Question 4
Define a class to declare a character array of size N, accept the characters into the array and perform the
following:
• Count the number of digits in the array and print.
• Replace the uppercase consonants with the lowercase, vowels with the uppercase and print the array.
Question 5
Define a class to declare an array of size 20 of integer data type, accept the elements into the array and
print the first number in the array which is not repeated later.