Computer Applications - Worksheet Computer Applications - Worksheet
Computer Applications - Worksheet Computer Applications - Worksheet
Choose the correct answers to the questions from the given options. Write the correct answer and options) (d) touppercase(String) (c) "Term"
1 (i) Return data type of isLetter(char) is ________. 2 ii) Method that converts a character to uppercase is (d) "TERMI"
(a) Boolean ________. 17 The array int x[5] occupies: 18 The element in x[5] of the array {3, 5, 7, 12, 16, 18,
(b) boolean (a) toUpper() (a) 10 bytes 20, 35, 42, 89} is:
(c) bool (b) ToUpperCase() (b) 40 bytes (a) 16
(d) char (c) toUppercase() (c) 20 bytes (b) 12
(d) toUpperCase(char) (d) 80 bytes (c) 7
3 Give the output of the following String methods: 4 Corresponding wrapper class of float data type is (d) 18
"SUCESS".indexOf('S') + "SUCESS".lastIndexOf('S') ________. 19 Give the output of the following code: 20 System.out.print("BEST ");
(a) 0 (a) FLOAT String P = "20", Q ="19"; System.out.println("OF LUCK");
(b) 5 (b) float int a = Integer.parseInt(P); Choose the correct option for the output of the
(c) 6 (c) Float int b = Integer.valueOf(Q); above statements
(d) -5 (d) Floating System.out.println(a+“ "+b); 1. BEST OF LUCK
5 (v) ________ class is used to convert a primitive 6 (vi) Give the output of the following code: 2. BEST
data type to its corresponding object. System.out.println("Good".concat("Day")); OF LUCK
(a) String (a) GoodDay 1 State the data type and value of res after the 2 Give the output of the following string functions:
(b) Wrapper (b) Good Day following is executed: 1. "ACHIEVEMENT".replace('E', 'A')
(c) System (c) Goodday char ch = '9'; 2. "DEDICATE".compareTo("DEVOTE")
(d) Math (d) goodDay res= Character.isDigit(ch);
7 A single dimensional array contains N elements. 8 The access modifier that gives least accessibility is: char ch = 't';
What will be the last subscript? (a) private res= Character.toUpperCase(ch);
(a) N (b) public 3 String x[] = {"SAMSUNG", "NOKIA", "SONY", 4 void test1(int n)
(b) N - 1 (c) protected "MICROMAX", "BLACKBERRY"}; {
(c) N - 2 (d) package Give the output of the following statements: for(int x=1; x<=n; x++)
(d) N + 1 1. System.out.println(x[1]); if(n%x == 0)
9 Give the output of the following code: 10 What will be the output of the following code? 2. System.out.println(x[3].length()); System. out.println(x);
String A = "56.0", B = "94.0"; System.out.println("Lucknow".substring(0, 4)); }
double C = Double.parseDouble(A); (a) Lucknow if 4 is passed to n. what are the values of x
double D = Double.parseDouble(B); (b) Lucks 5 6
System.out.println((C + D)); (c) Luck
(a) 100 (d) luck
(b) 150.0
(c) 100.0
(d) 150
11 A method with the same name as of the class and 12 int res = 'A'; What is the value of res?
with arguments and no return data type is termed (a) A
as: (b) 66
7 Consider the following class:
(a) parameterized constructor (c) 65
public class myClass
(b) default constructor (d) 97
{
(c) non-parameterized constructor
public static int x=3, y=4;
(d) wrapper class method
public int a=2, b=3;
13 The method to check if a character is an alphabet or 14 The output of Double.parseDouble("70.25") + 0.25
}
not is: is:
1.Name the variables for which each object of the class will have its own distinct copy.
(a) isLetter(char) (a) 70
2.Name the variables that are common to all objects of the class.
(b) isAlpha(char) (b) 70.50
8 Define a class named BookFair with the following description:
(c) isUpperCase(char) (c) 70.05
Instance variables/data members:
(d) isLowerCase(char) (d) 70.75
String bName - stores the name of the book
15 The method to convert a string to uppercase is: 16 The output of the method
double price - stores the price of the book
(a) toUpperCase(char) "DETERMINATION".substring(2, 6) is:
Member functions:
(b) toUPPERCASE(String) (a) "TERM"
void input() - to input and store the name and the price of the book
(c) toUpperCase(String) (b) term
void calculate() - to calculate the price after discount.
Computer Applications_worksheet Computer Applications_worksheet
21 Define a class to accept the names of 10 students in an array and check for the existence of the given name in the
array using linear search. If found, print the position of the name. If not found, print an appropriate message.
16
22 Define a class to declare an array of size twenty of double data type. Accept the elements into the array and
perform the following:
17 Define a class to declare a character array of size ten. Accept the characters into the array and display the
characters with highest and lowest ASCII (American Standard Code for Information Interchange) value.
EXAMPLE: