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

Comp Theory (2)

The document is an examination paper for a Computer Applications theory course, structured into two sections: Section A and Section B. Section A consists of multiple questions covering fundamental programming concepts, while Section B requires students to write Java programs based on given prompts. The paper emphasizes practical programming skills and theoretical knowledge in computer science.
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)
5 views

Comp Theory (2)

The document is an examination paper for a Computer Applications theory course, structured into two sections: Section A and Section B. Section A consists of multiple questions covering fundamental programming concepts, while Section B requires students to write Java programs based on given prompts. The paper emphasizes practical programming skills and theoretical knowledge in computer science.
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/ 5

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 1s" 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 questionsfrom Section A and anyfour questions from Section B.

om
The intended marksfor questions or parts of questions are given in brackets[].

.c
SECTION A (40 Marks)
Attempt all questions
rz
Question 1.
pe
(a) What are the default values of the primitive data type int and float? (2]
(b) Name any two OOP's principles. [2]
Pa

(c) What are identifiers? [2]


(d) Identify the literals listed below: [2]
(i) 0.5 (ii) 'A' (iii) false (iv) "a".
st

(e) Name the wrapper classes of char type and boolean type. [2]
Te

Question 2.

(a) Evaluate the value of n if value ofp= 5, q=19 .


int n = (q-p)>(p-q) ? (q-p) : (p-q);
(b) Arrange the following primitive data types in an ascending order of their
size:
(i) char (ii) byte (iii)double (iv) int. [2]
(c) What is the value stored in variable res given belo�:
double res = Math.pow ("H�".index0f('5'), 3); [2]
(d) Name the two types of constructors. [2]
This Paper consists of 5 printed pages and 1 blank page.
Tl5 861 Turn over
© Copyright reserved.
www.testpaperz.com
(e) What are the values of a and b after the following function is executed, if the
values passed are 30 and 50:
void paws( int a, fot b)
{ a= a+b;
b=a-b;
a=a-b;
System.out.println( a+", "+b);
( 2]

Question 3.
(a) State the data type and value of y after the following is executed:
char x='7';
y=Character.isLetter(x);

om
[2]
. (b) What is the function of catch block in exception handling? Where does it
appear in a program? [2]

.c
(c) State the output when the following program segment is executed:
String a ="Sm�phone", b="Graphic A:rt":
rz
String h=a.substring(2,5);
String k= b.substring(8).toUpperCase();
pe

System.out.println(h);
System.out.println(k.equalslgnoreCase(h)); [2]
Pa

(d) The access specifier that gives the most accessibility is �____and the
least accessibility is_,:�·---""------ [2]
(e) (i) Name the mathematical function which is used to find sine of an angle
st

given in radians.
Te

(ii) Name a string function which removes the blank spaces provided in tJ,ie
prefix and suffix of a string. [2]
(f) (i) What will this code print?
int arr[] =new int (5];
System.out.println(arr);
(i) 0 . (ii) value stored in arr[O] (iii) 0000 (iv)garbage value
(ii) Name the keyword which is used to resolve the conflict between method
parameter and instance variables/fields. [2]

2
T l5 861

www.testpaperz.com
(g) State the package that contains the �lass:
(i) BufferedReader
(ii) Scanner. [2]
(h) Write the output of the following program code:
char ch;
int x=97;
do
{
ch= (char) x;
System.out.print(ch + 11 ");
if( x%10=0)
break;
++x;,

om
}while(x<= 100); [2]
(i) Write the Java expressions for:
a2+b2 [2]
2ab

.c
rz
G) If int y=lO then find int z = (++y *(r++ +5)); [2]
pe

SECTION B (60 Marks)


Attempt anyfour questions from this Section.
Pa

The answers in this Section should consist ofthe Programs in either Blue J environment
or any program environment with Java as the base.
st

Each program should be written using Variable descriptions/Mnemonic Codes so that


the logic ofthe program is clearly depicted.
Te

Flow-Charts and Algorithms are not required.


¥Question 4.
Define a class called ParkingLot with the following description :

Instance variables /data members


int vno - To store the vehicle number
int hours - To store the number of hours the vehicle is parked in the parking lot
double bill : To store the bill amount
Member methods :
void input() - To input and. store the vno and hours.

3
T15 861 Turn Over

www.testpaperz.com
void calculate() - To compute the parking charge at the rate of <3for the first hour or part
thereof, and < 1.50 for each additional hour or part thereof.
void display()-To display the detail
Write a main method to create an object of the class and call the above methods. [I5]

�Question 5.
Write two separate programs to generate the following patterns using iteration (loop) statements:

(a) .., (b) 5 432 I


*-# 5432
. *' # * 543
*' # * # 54
*"# * # * 5

om
[15]
nuestion 6.
1
Write a program to inpu� and 'store roll numbers, names and marks in·� subjects of n

.c
number students in five single dimensional array and display the remark based on
average marks as given below: ( The maximum marks in the subject are 100)
rz
Average marks = Total Marks
pe
Average marks Remark
85 -100 EXCELLENT
Pa

75-84 DISTINCTION
60-74 FIRST CLASS
40-59 PASS
st

Less than40 POOR . [15]


Te

Qu�tion 7.
Desi�n a class to overload a function Joystring() as follows:
(i) void Joystring (String s, char chl, char ch2) with one string argument and two
character arguments that replaces the character argument chi with the
character argument ch2 in the given string s and prints the new string.
Example:
Input value of s ="TECHNALAGY"
ch l='A',
ch2='O'

4
T15 861

www.testpaperz.com
Output : "TECHNOLOGY"
(ii) void J oystring (String s) with one string argument that prints the position of the
first space and the Jast space of the given string s.
Example:
Input value of ="Giouc;l _comp�ti�g n:,.e?J;}�Jnt�ri;i)(t ,'1.asec;l,computing"
Output : First index : 5
Last index : 36
(iii)void Joystring ( String sl, String s2) with two string arguments that combines
the two strings with a space between them and prints the resultant string..
Example:

om
Input value of sl ="COMMON WEALTH".
Input value of s2="GAMES"
Output: COMMON WEALTH GAMES

.c
(use libraryfunctions)
[15]
,-Oiiestion 8.
rz
Write a program to input twenty names in an array. Arrange these_names in descending
pe
order of alphabets, using the bubble sort technique. · i [ 15]

�uestion 9.
Pa

Using the switch statement, write a menu driven program to:


(i) To find and display all the factors of a number input by the user (including 1 and
st

excluding number itself).


Example:
Te

Sample Input n = 15
Sample Output 1,3, 5
(ii) To find and display the factorial of a number input by the user (the factorial of a
non-negative integer n, denoted by n!, is the product of� 4\tegers less than or
equal to n.
Example:
Sample Input n =5
Sample Output 5! = lx2x3x4x5 =120.
For an incorrect choice, an appropriate error message should be displayed. [15]

5
Tl5 861

www.testpaperz.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy