0% found this document useful (0 votes)
270 views

Attempt All Questions From This Section

The document contains 9 questions related to computer applications and programming in Java. Question 1 has 5 subparts asking about class attributes, access specifiers, abstraction, Java packages, and compound statements. Question 2 has 5 subparts about data types, strings, arrays, and literals. Question 3 has 10 subparts on operators, comparisons, loops, errors, keywords, and arrays. Sections B contains 4 programming questions requiring students to write Java classes to model students, ISBN validation, string analysis, and city name sorting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
270 views

Attempt All Questions From This Section

The document contains 9 questions related to computer applications and programming in Java. Question 1 has 5 subparts asking about class attributes, access specifiers, abstraction, Java packages, and compound statements. Question 2 has 5 subparts about data types, strings, arrays, and literals. Question 3 has 10 subparts on operators, comparisons, loops, errors, keywords, and arrays. Sections B contains 4 programming questions requiring students to write Java classes to model students, ISBN validation, string analysis, and city name sorting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

COMPUTER APPLICATIONS

(Two Hours)

SECTION – A (40 MARKS)


ATTEMPT ALL QUESTIONS FROM THIS SECTION.
Question 1.
a) Mention any two attributes required for class declaration.
b) Explain any two types of access specifiers.
c) What do you understand by Abstraction? Explain with an example.
d) Name any two packages in the java class library.
e) What do you mean by compound statement? Explain with an example.
Question 2.

a) Distinguish between character constant and string constant with an example. [2x5]
b) Arrange the given data types in descending order of their
size: char, long, float, Boolean
c) Write the appropriate function to do the following:
1) To add two strings.
2) To take out a character from a string at any position.
d) What do you understand by Literals? Name any one. [2x5]
e) Write down the format to assign 10 names in a single dimensional array.

Question 3.

a) Rewrite the given code using Ternary operator:


If( a != b) p=a–b;
Else p=b–a;
b) What is the difference between: == and equals() ?
c) What will be the output of the following, if a=4 , b=2 initially?
1) a* = a % b 2) a+= --a + a++ + a
d) Give the output of the following statements: [2x10]
1) System.out.print(Math.ceil(-6.25));
2) System.out.print(Math.Floor(-6.25));
e) Write one similarity and one difference between for loop & while loop.
f) Name the type of errors (syntax,run time or logical) :
1) Division by a variable that contains a value of zero.
2) Missing semicolon.

Page 1 of 3

g) Name the keyword that:


1) Is used for allocating memory to an array.
2) Causes the control to transfer back to the method call.
h) State any two features of constructor.
i) Give the prototype of a function search which receives a sentence sentc and a word wrd and returns
1 or 0 .
j) Write the total bytes required to store the given arrays in the computer’s memory:
1) Int a[] = {1,2,3,4,5};
2) Char b[] = {‘a’,’e’,’I’,’o’,’u’};

SECTION – B (60 MARKS)


(Attempt any four in this section)
(Each program should be written using variable description)
Question 4.

Define a class student described as below:


Data members/instance variables:
Name, age, m1, m2, m3 (marks in 3 subjects), maximum, average
[15]
Member Functions:

i) A parameterized constructor to initialize data members like name, age, m1, m2, m3
ii) void compute() – to calculate the average and maximum out of three marks
iii) void display() – to display the name, age, marks in three subjects, maximum and average Write a
main() method to create an object of the class and call the above member methods.

Question 5.

The International Standard Book Number (ISBN) is a unique numeric book identifier which is printed on every
book. The ISBN is based upon a 10-digit code.
The ISBN is legal if: 1xdigit 1 + 2xdigit2 + 3xdigit3 + …………….+ 10xdigit10 is divisible by 11
[15]
Example: For an ISBN 1401601499
Sum= 1x1 + 2x4 + 3x0 + 4x1 + 5x6 + 6x0 + 7x1 + 8x4 + 9x9
= 253 , which is divisible by 11.
Write a program to:

i) input the ISBN code as a 10-digit integer.


ii) If the ISBN code is not a 10-digit integer, output the message, “Illegal ISBN” and terminate the
program.
iii) If the ISBN code is a 10-digit, extract the digits of the code and compute the sum as explained
above.
If the sum is divisible by 11, output the message “Legal ISBN”
If the sum is not divisible by 11, output the message “Illegal ISBN”

Page 2 of 3
Question 6.

Write a program to input any string to calculate the total number of characters leaving blank spaces, total
number of vowels(consider both cases) present in the string and also print the total number of words.

Example:
If sample Input: Human like Apples
[15]
Output: Total characters leaving blank spaces :- 15
Total vowels :- 6
Total number of words :- 3
Question 7.

Define a class city and store the given city name in a single dimensional array. Sort these city names in
alphabetical order using bubble sort technique only, then print the sorted list.
Sample Input: Mumbai, Kolkata, Agra, Delhi, Bangalore
Sample Output: Agra, Bangalore, Delhi, Kolkata, Mumbai
[15]
Question 8. [15]
Write a program to accept a string in lower case. Convert the first character of each word of the string to
uppercase and display the new string.
Sample input: india got independence in nineteen forty seven
Sample output: India Got Independence In Nineteen Forty Seven

Question 9. [15]
Design a class to overload a function calculation() as follows:

a) Int calculation (int n, char ch) with one integer argument and one character argument. It computes the cube
of an integer if choice ‘ch’ is ‘C’ otherwise computes its square.
b) Int calculation (int a, int b, char ch) with two integer arguments and one character argument. It
c) Computes the remainder if choice ‘ch’ is ‘R’ otherwise find the quotient.
or not. calculation (String x, String y) with two string arguments that check whether strings are equal
Boolean

You might also like