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

Computer Applications 2020

The document discusses a theory exam on computer applications. It contains two sections - section A contains 10 multiple choice questions on Java concepts like byte code, classes, objects, data types, operators etc. Section B contains 4 questions to write Java programs related to topics like binary search, string manipulation, method overloading, menu driven programs etc.

Uploaded by

Jeethesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Computer Applications 2020

The document discusses a theory exam on computer applications. It contains two sections - section A contains 10 multiple choice questions on Java concepts like byte code, classes, objects, data types, operators etc. Section B contains 4 questions to write Java programs related to topics like binary search, string manipulation, method overloading, menu driven programs etc.

Uploaded by

Jeethesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

COMPUTER APPLICATIONS

(Theory)

(Two Hours)

Answers to this Paper must be written on the paper provided separately.

You will not be allowed to write during the first 15 minutes.

This time is to be spent in reading the question paper.

The time given at the head of this Paper is the time allowed for writing the answers.

This Paper is divided into two Sections.

Attempt all questions from Section A and any four questions from Section B.

The intended marks for questions or parts of questions are given in brackets [ ].

SECTION A (40 Marks)


Attempt all questions

Question 1.
(a) Define Java byte code. [2]

(b) Write a difference between class and an object. [2]

(c) Name the following: [2]

(i) The keyword which converts variable into constant.

(ii) The method which terminates the entire program from any stage.

(d) Which of the following are primitive data types? [2]

(i) double

(ii) String

(iii) char

(iv) Integer

(e) What is an operator? Name any two types of operators used in Java. [2]

This Paper consists of 6 printed pages.


T20 861 Turn Over
© Copyright Reserved

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 2.
(a) What is autoboxing in Java? Give an example. [2]

(b) State the difference between length and length() in Java. [2]

(c) What is constructor overloading? [2]

(d) What is the use of import statement in Java? [2]

(e) What is an infinite loop? Give an example. [2]

Question 3.
(a) Write a Java expression for the following: [2]

√𝑏 2 − 4𝑎𝑐

(b) Evaluate the following if the value of x=7, y=5 [2]

x+=x++ + x + ++y

(c) Write the output for the following: [2]

String s1 = ''Life is Beautiful'';

System.out.println (''Earth'' + s1.substring(4));

System.out.println( s1.endsWith(''L'') );

(d) Write the output of the following statement: [2]

System.out.println(''A picture is worth \t \''A thousand words.\'' '');

(e) Give the output of the following program segment and mention how many times [2]
the loop will execute:

int k;

for ( k = 5 ; k < = 20 ; k + = 7 )

if ( k% 6==0 )

continue;

System.out.println ( k );

(f) What is the data type returned by the following library methods? [2]

(i) isWhitespace()

(ii) compareToIgnoreCase()

T20 861 2

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


(g) Rewrite the following program segment using logical operators: [2]

if ( x > 5 )

if ( x > y )

System.out.println (x+y);

(h) Convert the following if else if construct into switch case: [2]

if (ch== 'c' || ch=='C')

System.out . print(''COMPUTER'');

else if (ch== 'h' || ch=='H')

System.out . print(''HINDI'');

else

System.out . print(''PHYSICAL EDUCATION'');

(i) Give the output of the following: [2]

(i) Math.pow (36,0.5) + Math.cbrt (125)

(ii) Math.ceil (4.2 ) + Math.floor (7.9)

(j) Rewrite the following using ternary operator: [2]

if(n1>n2)

r = true;

else

r = false;

T20 861 3 Turn Over

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


SECTION B (60 Marks)
Attempt any four questions from this Section.
The answers in this Section should consist of the Programs in either Blue J environment or any
program environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonic Codes so that the logic
of the program is clearly depicted.
Flow-Charts and Algorithms are not required.

Question 4.
A private Cab service company provides service within the city at the following rates: [15]

AC CAR NON AC CAR


UPTO 5 KM ₹ 150 /- ₹ 120 /-
BEYOND 5 KM ₹ 10/-PER KM ₹ 08/- PER KM
Design a class CabService with the following description:

Member variables /data members:

String car_type - To store the type of car (AC or NON AC)

double km - To store the kilometer travelled

double bill - To calculate and store the bill amount

Member methods :

CabService() - Default constructor to initialize data members.

String data members to '' '' and double data

members to 0.0.

void accept () - To accept car_type and km (using Scanner class


only).

void calculate () - To calculate the bill as per the rules given above.

void display() - To display the bill as per the following format

CAR TYPE:

KILOMETER TRAVELLED:

TOTAL BILL:

Create an object of the class in the main method and invoke the member methods.

T20 861 4

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 5.

Write a program to search for an integer value input by the user in the sorted list given [15]
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}

Question 6.
Write a program to input a sentence and convert it into uppercase and display each [15]
word in a separate line.

Example: Input : India is my country

Output : INDIA

IS

MY

COUNTRY

Question 7.
Design a class to overload a method Number( ) as follows: [15]

(i) void Number (int num , int d) - To count and display the frequency of a
digit in a number.

Example:

num = 2565685

d=5

Frequency of digit 5 = 3

(ii) void Number (int n1) - To find and display the sum of even digits of
a number.

Example:

n1 = 29865

Sum of even digits = 16

Write a main method to create an object and invoke the above methods.

T20 861 5 Turn Over

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC


Question 8.

Write a menu driven program to perform the following operations as per user’s choice: [15]

(i) To print the value of c=a2+2ab, where a varies from 1.0 to 20.0 with increment
of 2.0 and b=3.0 is a constant.

(ii) To display the following pattern using for loop:

A
AB
ABC
ABCD
ABCDE

Display proper message for an invalid choice.

Question 9.

Write a program to input and store integer elements in a double dimensional array of [15]
size 3 x 3 and find the sum of elements in the left diagonal.

Example:

1 3 5

4 6 8

9 2 4

Output: Sum of the left diagonal elements = (1 + 6 +4) = 11

T20 861 6

Click this link to buy latest Educart books on Amazon - https://amzn.to/3sO7MAC

You might also like