0% found this document useful (0 votes)
57 views2 pages

Computer Applications - Worksheet Computer Applications - Worksheet

Uploaded by

Shilpa K.V.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views2 pages

Computer Applications - Worksheet Computer Applications - Worksheet

Uploaded by

Shilpa K.V.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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

Discount is calculated based on the following criteria: INPUT:


Price Discount 'R', 'z', 'q', 'A', 'N', 'p', 'm', 'U', 'Q', 'F'
Less than or equal to ₹ 1000 2% of price OUTPUT:
More than ₹ 1000 and less than or equal to ₹ 3000 10% of price Character with highest ASCII value = z
More than ₹ 3000 15% of price Character with lowest ASCII value = A
void display() - to display the name and price of the book after discount.
Write a main() method to create an object of the class and call the above methods. 18 Write a program to input n number of integer elements in an array and sort them in descending order using
9 Define a class to overload the method print as follows: bubble sort technique and print the sorted list.
void print() - to print the format:
A 19
AB
ABC
ABCD
boolean print(int n) - to check whether the number is a Perfect number. A number is perfect if the sum of the
factors excluding that number is same as original number
Example: 6
its factor 1+2+3=6
void print(int n, char ch) - If ch = 's' or 'S' print the square root of the number if ch = 'c' or 'C' print the cube root of
the number
10 Write a program to search for an integer value input by the user in the sorted list given below using binary search
technique. If found, display "Search Successful" and print the element, otherwise display "Search Unsuccessful"
{31, 36, 45, 50, 60, 75, 86, 90}
11 Define a class and store the given student names in a single dimensional array. Sort these names in alphabetical
order using the Bubble Sort technique only.
INPUT:sudha ,hari, sushama ,anamika,chirag
OUTPUT: anamika chirag hari sudha sushama
12 Write a program in Java to accept a string and count the total number of vowels present in the string word wise
Reverse order INPUT: We are in cyber world OUTPUT: Total no of Vowels=6
13 20 Write a class to overload a function numCalc() as follows:
i) void numCalc(int num, char ch) - with one integer argument and one character argument, computes the square
of integer argument if choice ch is 's' otherwise finds its cube.
ii) void numCalc(int a, int b, char ch) - with two integer arguments and one character argument. It computes the
product of integer arguments if ch is 'p' else adds the integers.
14 Define a class to store 20 numbers in a single dimensional array and then display sum pf all prime numbers iii) void numCalc(String s1, String s2) - with two string arguments, which prints whether the strings are equal or
15 not.

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:

 Calculate and print the product of all the elements


 Print the square of each element of the array

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:

You might also like