[go: up one dir, main page]

0% found this document useful (0 votes)
11 views14 pages

Class9CommApp 20250103093740

The document contains multiple choice questions and output questions for Class IX Computer Applications, covering topics such as ASCII codes, data types, OOP principles, Java syntax, and mathematical functions. It includes 71 multiple choice questions and various coding snippets requiring output analysis. The questions test knowledge on Java programming concepts, operators, and control structures.

Uploaded by

rithvikteja6b
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)
11 views14 pages

Class9CommApp 20250103093740

The document contains multiple choice questions and output questions for Class IX Computer Applications, covering topics such as ASCII codes, data types, OOP principles, Java syntax, and mathematical functions. It includes 71 multiple choice questions and various coding snippets requiring output analysis. The questions test knowledge on Java programming concepts, operators, and control structures.

Uploaded by

rithvikteja6b
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/ 14

REVISION

Class IX Subject: Computer Applications


Multiple Choice Questions

1)The ASCII codes of upper case alphabets range from:


A) 65 - 90 C) 65 - 91
B) 60 - 85 D) 97 - 122

2) Which of the following is non-primitive data?


A) char C)long
B) short D) object

3) Which feature of OOPS derives the class from another class?


A) Inheritance C) Encapsulation
B) Data hiding D) Polymorphism

4) Which is not a feature of OOP in general definitions?


A) Efficient Code C) Modularity
B) Code reusability D) Duplicate/Redundant data

5) Which of the following converts high language program in machine code at


once
A) Compiler C) assembler
B) Interpreter D) java virtual machine

6) which symbol is used for multiline comments


A) /……/ C)//
B) \* D) /*......*/

7) Variable that is declared with in the body of the method is termed as


A) Local variable C) class variable
B) Global variable D) argument variable

8) which of the following is a primitive data types in java


A) Array C) String
B) Class D) byte

9) Which of the following is a primitive data type?


A) Double C) boolean
B) Byte D) Integer

10)Which of the following is a valid variable declaration and initialization?


A) s=12; int s; C) s=12.
B) s=12 D) int s; s=12;

11) Which of the following is not a token?


A) Operator C) Keyword
B) Statement D)Identifier
12)The new line character is represented by _____
A) ‘\n’ C) ‘\t’
B) ‘\a’ D) ‘\\’

13)Which of the following is an assignment operator?


A) = = C) !=
B) = D) ||

14) The act of representing essential features without including the background
details.
A) Abstraction C) Encapsulation
B) Inheritance D) Polymorphism

15) _______ is an identifiable entity with some characteristics and behavior.


A) object C) continue
B) class D) statements

16) Which of the following is not a keyword of Java?


A) continue C) exit
B) private D) break

17) Scanner class is present in ____ package.


A) java.lang C) java.util
B) java.io D) java .awt

18) The statement System.out.println(“six” +3+3) ; gives the output


A) six 33 C)33 six
B) six 6 D)6 six

19) What is the value of x after evaluating the following


x= Math.round(Math.max(7.6,3.5));
A) 7.0 C)8.0
B) 7 D)8

20) A Java compiler


A) translates line by line C) is not a translator
B) translates an entire program D) is a machine language

21) If x=1; find the value of y


y=x+ (x++);
A) 2 C) 3
B) 1 D)-2

22) Which of the following is the size of a float data type in Java?
A) 8 bytes C) 2 bytes
B) 4 bytes D) 1 byte

23) Which of the following is an invalid literal?


A) ‘6’ C) “3+4”
B) “xyz” D) 1,000.42
24) Which one of the following method returns the largest from the given two
numbers -
A) maxm( ) C) Math.Max()
B) Math.max( ) D) MAX

25) Which keyword do you use to include a package in a program?


A) import C) include
B) export D) impart

26) Which of the following is the default value of long datatype


A) 0 C)0L
B) long 0 D)0.0

27) A character literal is enclosed in:


A) ' ' C): :
B) " " D) { }

28) Which of the following punctuator is the statement terminator in java?


A) ; C) ,
B) . D)All of these

29) Which of the following is not a legal identifier?


A) _age C) $Amount
B) 9thClass D) THIS

30) The access modifier that gives more accessibility is


A) Protected C) Package
B) Public D) Private

31) Which of the following is a keyword?


A) Character C) Object
B) Break D) Attributes

32) Which of the followings not a token


A) Operator C) Keyword
B) Statement D) Identifier

33) The storage size of char datatype is


A) 2 bytes C)1 bytes
B) 3 bytes D) 4 bytes

34) If int a = 25, b = 5, c = 0; what value is stored in c? When c = a % b;


A) 5.0 C) 0
B) 5 D) 25

35) What is the result of the expression :10+5*8-15/5


A) 3 C) 7
B) 47 D) 21
36) An operator taking only single operand for its operation is called
A) A unary operator C) A ternary operator
B) A binary operator D) none of these

37)Which of the following is a special operator to allocate memory:


A) New C) new
B) final D) dot

38) identify the type of error in the following code


Math.sqrt(30-45);
A) Syntax error C) Runtime error
B) Logical error D) All the above

39) Default delimiter used in the Scanner class is


A) Comma C) Colon
B) Whitespace D) There is no default delimiter

40) Identify the type of error


int myint = “123”;
A) Syntax error C) Run time error
B) Logical error D)None of these

41) What is the return datatype of Math.random()?


A) int C) double
B) float D) long

42) Which of the following is not a character literal?


A) ‘\t’ C)’t’
B) “t” D) All of these

43) Which keyword is used while declaring value to a variable constant.


A) final C) public
B) new D) double

44) Which operator is used to compare two values?


A) Arithmetic C) Logical
B) Relational D) Bitwise

45) Give the output of the following


Math.sqrt(Math.max(9,16));
A) 4 C)3.0
B) 4.0 D)3

46) Give the output of the following


int a=7.76;
double x=Math.abs(Math.floor(a));
A) 8.0 C) 8
B) 7.0 D) 7

47)Which of the following will produce 9 if x=9.9?


A) Math.ceil(x) C) Math.abs(x)
B) Math.floor(x) D) Math.round(x)
48) The return value of Math.abs(Math.cbrt(-216.0)) is
A) 6.0 C) 6.6
B) 6.2 D) 6

49) Give the output of the following Math function:


Math . max (2, Math . min (3,4));
A) 3.0 C) 4
B) 3 D) 2

50) Give the output of the following Math function:


Math . round (Math.abs (-2.5));
A) 3 C) -3
B) 3.0 D) -3.0

51) The statement (1==1)?1:0 evaluates to


A) 0 C) false
B) 1 D) true

52) The statement i=i+1 is equivalent to


A) i++ C)++i
B) i+=1 D)All of these

53) What will be the output of the snippet if x=5 and y=10?
y=(x>=y)?++x:++y
A) 7 C) 11
B) 9 D)13

54) The expression 4+8%2 gives the output


A) 6 C) 4
B) 8 D) None of these

55) Which of the following loops is mostly used for fixed iterations?
A) for C) do-while
B) while D) if-else

56) Which of the following is not a jump statement


A) continue C) break
B) return D) terminate

57) The loop : for(char y=’e’; y<’n’ ;y++), produces:


A) Letters from e - h C) Letters from e - g
B) Letters from f - g D) Letters from f - h

58) Which of the following is mandatory in the switch statement?


A) break C) case
B) continue D) default

59) Which operator cannot be used with if-else statement?


A) <= C) &&
B) || D) ? :
60) How many times the loop, for (i=1; ;i++), will execute, if there is no statement
to terminate
the loop?
A) 1 C) infinite
B) 0 D) The loop will not execute

61) Which of these selection statement test only equality?


A) If C) switch
B) If-else D) if & switch

62)Which operator can not be used with if else statement?


A) < = C) &&
B) || D) ?:

63) Which of the following Loop executes atleast once?


A) for C) do while
B) while D) None of these

64) The process of assigning a value to a variable for the first time
A) updation C) declaration
B) initialisation D) calculation

65) When the if statement written with another if it is called a


A) if else C) switch
B) if else if D) nested if

66) Which of the following is a simple conditional statement?


A) if( ) C) case
B) elseIf D) break

67) Which of the following is a jump statement?


A) if( ) C) exit
B) do D) break

68) Assertion: The ++ operator can be used to increment a character variable in


Java.
Reasoning: The ++ operator is not limited to numeric types and can be applied
to characters as well.
a) Both the assertion and reasoning are correct, and the reasoning explains the
assertion.
b) Both the assertion and reasoning are correct, but the reasoning does not
explain the assertion.
c) The assertion is correct, but the reasoning is incorrect.
d) Both the assertion and reasoning are incorrect.

69) The picture given below represents which of the OOPS concepts.

a)Abstraction b)Encapsulation c)Polymorphism d)Inheritance


70) Assertion: Inheritance in OOPs allows a class to inherit properties and behavior
from another class.
Reasoning: This promotes code reusability and establishes a relationship
between the parent (superclass) and the child (subclass) classes.
a) Both Assertion and Reasoning are true, and Reasoning is the correct
explanation for the Assertion.
b) Both Assertion and Reasoning are true, but Reasoning is NOT the correct
explanation for the Assertion.
c) Assertion is true, but Reasoning is false.
d) Assertion is false.

71) The picture given below represents which of the following OOPS concepts.
a)Abstraction b)Encapsulation c)Polymorphism d)none of the above

72) Assertion:Polymorphism is the ability of objects to take on different forms or


behaviors
Reasoning:Reasoning: Polymorphism is one of the OOP’s principles.
a) Both Assertion and Reasoning are true, and Reasoning is the correct
explanation for the Assertion.
b) Both Assertion and Reasoning are true, but Reasoning is NOT the correct
explanation for the Assertion.
c) Assertion is true, but Reasoning is false.
d) Assertion is false.
ANNUAL REVISION
Class IX Subject: Computer Applications
OUTPUT QUESTIONS

What is the output of the following code :

Question
State the values of n and ch after executing the following code
char c=’c’;
int n=c+1;
char ch=(char)n;

int x=72;
char y=(char)x;
System.out.println(x+" "+y);

Give the output for the following math functions:


a) Math.floor(81.2)
b) Math.ceil(-8.76)
c) Math.round(28.9)
d) Math.abs(-73.25)
e) Math.sqrt(81)
f) Math.pow(-2,3)
g) Math.cbrt(125)

What will be the value of the following


int a=6,b=5;
a += (a++) %( b++) *a +( b++)*( - -b);

int a=11, b=22, c;


c = a + b + (a++) + (b++) + (++a) + (++b);

int i=19, j=29, k;


k = (i- -) - (i++) + (- -j) - (++j) + (- -i) - (j- -) + (++i) - (j++);

int a=1;
a = (a++) + (++a) *( - -a) -( a- -);

i = (i++) - (- -i) + (- -i) *(i- -); where i=20

Write the equivalent java expression for the following mathematical expression
5 5 3
s= 10
+ 𝑥 +5𝑥

5 3
s= 𝑎𝑥 +𝑏𝑥 + c

2 2 2
T= (𝐴 + 𝐵 + 𝐶
2 2
𝑎 +𝑏
s= 2𝑎𝑏

3 4
X=|𝐴| + |𝐵| + (𝐴 + 𝐵 )

| 𝑎3+𝑏3 |
x= | 3 3 |
| 𝑎 −𝑏 |

3 𝑎+𝑏
s= 𝑎𝑏

3 3 𝑥𝑦
z= 𝑥 +𝑦 + 3

Rewrite the following using ternary operator:


int x = 20;
y = (x == 20) ? 61 : 90;
System.out.println("Value of y is: " + y);

Give the output of the snippet:


int a=10,b=12;
if(a==10&&b<=12)
a--;
else
++b;
System.out.println(a + " and " +b);

int s=0;
for(int x=1; x<=5; x+=2)
s+=x;
System.out.println(s);

int m = 5, n = 10;
while (n>=1)
{
System.out.println(m*n);
n–-; }

int x = 69;
int y = 89;
int z = 79;
int largestNumber = (x > y) ? (x > z ? x : z) : (y > z ? y : z);

Give the output of the following code when


(i) opn = ‘b’
(ii) opn = ‘x’
switch (opn)
{
case ‘a’:
System.out.println(“Simply Coding”);
break;
case ‘b’:
System.out.println(“Online Tutor”);
case ‘c’:
System.out.println(“Online Courses”);
default:
System.out.println(“Invalid Input”);
}

Rewrite the following program code using the suitable ‘if’


statement
switch(m)
{
case 0: x=x+2;
System.out.println(“X=” x);
break;
case 1: x=x+4;
System.out.println(“X=” x);
break;
case 2: x=x+6;
System.out.println(“X=” x);
break;
}

Write an equivalent while() loop for the following for() loop.


int s=0;
for(int x=1; x<=25; x+=2)
s+=x;

Write the output of the following code segment:


class Java {
public void main(){
System.out.println("Indian Certificate ");
System.out.print("for"+”\t”);
System.out.println("Secondary Education");
}}

Give the output of the following program segment and also mention how many times the loop is executed:
int i;
for (i = 5 ; i < 10; i++)
{
System.out.println(i);
}
System.out.println(i * 4);
JOHNSON GRAMMAR SCHOOL
MALLAPUR
ANNUAL REVISION
Class IX Subject: Computer Applications
PROGRAMS
1) Write a program to accept a integer and check whether it is perfect square or not
1. Ex: 25 sqrt=5.0 it is a perfect square
2. Ex : 3 sqrt=1.713 it is not a perfect square

2) Write a program to accept P, T and R values, find simple interest and compound interest and find their
difference.
SI S.I. = (Principal × Rate × Time)/100

CI C.I. = Principal ((1 + Rate))/100Time −


Principal

3) The daily wages paid to a worker is rs 60/day.he works 3 days in the first week , 5 days in the second
week, 2 days in the third week and 7 days in the fourth week. Write a program to compute and
payment he gets in this month

4) Write a program , to convert a given temperature from Fahrenheit to Celsius (c = 5/9*(f-32)) and
Celsius to Fahrenheit (f = 1.8*c +32) (Accept appropriate values wherever required)

5) The distance between two electric poles is accepted in meters, calculate and print the distance in
kilometer and meter

6) Write a program to calculate the final salary after increment. Salary increment of employees based on
their basic pay.
BASIC PAY INCREMENT

Upto 5000 300/-

5001/- to 10000/- 550/-

10001/- to 15000/- 750/-

15001/- to 20000/- 1050/-

Above 20000 1500/-

7) Define a class ElectricityBill with the following description


Instance variables/ data members:
String n - To store the name of customer.
int units - To store the number of units consumed.
double bill - Stores the amount to be paid

Member Methods:
void accept() - To input the name of customer and number of units
consumed using Scanner class.
void calculate() - To calculate the bill as per the given criteria:

Number of units Rate per unit


First 100 units Rs 2.00
Next 200 units Rs 3.00
Next 300 units Rs 5.00
Above 600 units Rs 8.00

void display() - To display the details in the following format


Name of customer: …………………
Number of units consumed: ……………………
Bill Amount: ……………………..
8) Write a program to input a character . Convert the character into its opposite case .Print the original
and converted character.
Eg: input : G
Output : G g

9) Write a program to input three angles of a triangle and check whether a triangle is possible or not. If
possible then check whether it is an acute-angled triangle, right-angled or an obtuse-angled triangle
otherwise, display 'Triangle not possible'.
Sample Input: Enter three angles: 40, 50, 90
Sample Output: Right=angled Triangle

10) An institution has decided to admit new candidates in different streams on the following criteria

TOTAL MARKS OBTAINED STREAM OFFERED

300 Above Science

200 and above but less than 300 Commerce

Below 200 but not below 75 Arts

otherwise Admission not granted


Write a program to input name of the student , total marks obtained in a examination and print the
output as follows
NAME TOTAL MARKS STREAM OFFERED
******** ************* *****************

11) Write a program to input the prize of the product and quantity purchased . calculate the total cost and
discount on total cost as per the given criteria.
TOTAL COST DISCOUNT

₹1000.00 to ₹5000 .00 3.0%

₹ 10000.00 5.5%

₹15000.00 7.5%

More than ₹30000.00 10.0%


Calculate the net amount to be paid after discount.print the price , quantity , total cost, discount and net
amount to be paid.

12) Mr. Kumar is an LIC agent. He offers a discount to his policy holders on the annual premium.
class name: Policyholder
Data Members:
name - to accept customer name
sum - to accept the sum assured
disc- to calculate discount
Member methods:
Input() - name(String), sum(double)
Calculate- find the discount amount based on the following criteria
Sum Assured Discount

Up to ₹ 1,00,000 5%

₹ 1,00,001 and up to ₹ 2,00,000 8%

₹ 2,00,001 and up to ₹ 5,00,000 10%

More than ₹ 5,00,000 15%


display()- to print all the details
Name of the policy holder :
Sum assured :
Discount :

13) A DTDC Courier company charges for the pickles packing services for its customers as per the
following specification given below
Weight in Kgs Charge per kg

Upto 3 kgs 200

Next 5 kgs 350

Above 8 kgs 450


Accept customer name and Weight of the parcel.Calculate and Print the name of the customer , weight
of the parcel and total bill in the following format.
Customer Name : *********
Weight of the parcel : ********
Bill amount to be paid : ********

14) The volume of solids, cuboid, cylinder and cone can be calculated by the Formula:
a) Volume of a cuboid: (v = l × b × h)
b) Volume of a cone: (v = 1/3× π × r²× h) (π = 22/7)
Using a switch case statement, write a menu driven program to find the volume of different
solids by taking suitable variables and data types.

15) Write a program to accept a number and check and display whether it is a spy number or not. (A
number is spy if the sum of its digits equals the product of its digits.)
Example : consider the number 1124,
Sum of the digits = l + l+ 2 + 4 = 8
Product of the digits = 1×1 x2x4 = 8

16) Write a program to accept 25 characters using for() loop. Find and Print the following counters.
i) Number of Uppercase characters
ii) Number of Lowercase characters
iii) Number of Other characters

17) Write a program to input a number and check if it is a Nest number or not
Hint : A number is said to be a ‘Nest Number’ if the number contains at least one digit which is zero.”
Eg 1 Input : 2008 Output : It is a Nest Number
Eg 2 Input : 238 Output : Not a Nest Number

18) Using a switch case write a menu driven program to print the following
1. PATTERN:
11111
3333
555
77
9
2. Print the given series using a for loop.
10 2 30 4 50 6 … upto n terms

19) a) Print the series 5 8 11 14 17 ……………….. Ten terms (3n+2)


𝑥+1 𝑥+2 𝑥+3 𝑥+4 𝑥+𝑛
b) Print the sum of the series 5! + 10! + 15! + 20! ……………… 5𝑛!
c) Print the series 0 1 3 7 15 31 ……………………… (2n-1) ------- Accept n value for the last term

20) Write a program to print the following patterns using 2 methods


a) 1 b) F E D C B A
10 FEDCB
101 FEDC
1010 FED
10101 FE
F

You might also like