We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
Bethany High , Computer Dept.
Computer Applications Study Plan for Second Unit Test
Std: X (LC.S.E.)
I. Student must know the definition of the given terms with proper example :
22.
23.
24.
Types of Java Program - i, Java Application ii. Applet
Yypes of error — i. Syntax Error ii. Run-time error (Exception)
ogical Error — Instead of > sign , < sign used. Output is wrong ete
Java Byte Code Pa.-4 (310-9 \+8).
Java Virtual Machine fy-(510° 4780) i
Types of C at i Wine on, rabtilome ee Escammarsto%e”
‘ypes of Comments statement in Java — dunn fe “mt,
Tokens and its type : i. Identifier ii. Constant or Literals iii. Reserved
Words (Keywords) , Separators (Punctuators)
Difference between System.out.printin( ) and System.outprint( ) =
Escape Sequence Character - p., -13(¢+0-9-r6)) is
Purpose (Use ) of Primitive dati type ~ 23 (s77-9)
Java's Primitive Data Type or Intrinsic Data type with memory size fo, 2s
Data Range for short and byte data type-f9-°3""
Unicode -t3,-24¢" *?
Variables and how to declare it ~
Define a constant in Java — (Keyword : final ) fa, 28’ ny
Assignment Statement- "
Expression in Java ~ ?, 290 )
Implicit ( Automatic Type — No Loss of Data ) and Explicit Casting — ( Loss
of Data) °: By
Operators - Arithmetic Operator (It is also called as Binary operator - +, -
*,/) Arithmetic Assignment Operator (+, /=,%-) Relational
Operator (>, <, >=, <=; !=, ==) and Logical Operator ( &&, || and !)
Ternary Operator (?:) - Three Way Operator
Unary Operator (++, - -, -10)
Operator Precedence ~ Refer Pg 48 from Teach yourself Java
1a(s10-a"8))
Ay
ns
wae)
Programming f
fh Oven é 4
Use of Parenthesis in computation °° i aaa ee
Math Function (Math Class found in java.lang package) ~" 1s. (ofo.s
Mat.sqrt() , Math.pow( ) , Math.abs( ), Math.random( ), Math.max() ,
‘Math.min( ), Math.round( ), Math.ceil( ), Math.floor( ), Math.rint()
Control Statement (9, O94 1)
Selection Statement - (Decision Making Statement — if, switch and ?:
(Ternary Operator or conditional operator)
BY PANKAJ KUMAR CHOUDHARY ~ COPYRIGHT@202396. . Iteration Statement — Loops ( for (), while () and do.. -while()
27, Jump statement — break, continue , System.exit(0), return
28. Entry Controlled Loop — for( ) & while( )
29. Exit Controlled loop() — do... while ()
30. Difference between for,and while loop
31. Difference between while’and do.. while loop
32. _ switch statement — It works on integer or character data type
33. _ Difference between if ..else and switch statement
34. Use of default statement in switch 9-12" aD
35. Fall Through 3-79" ”)
36. Dangling else statement fo,-g0t
37. Block statement i
38. Scope of Variables or Visibility rules - °o,171480"" 2
39. Use of Comma ina for loop- fo 32" ”)
40. How to make for any loop as infinite loop - ne conker
2
U. a. Compute the value related with ++ and -- --
Note :
1. Drop the value when a variable comes otherwise take action.
2. According to order compute the value
First Order—(_ )
Second Order-* , / and % - From left first come first serve
Third Order-+and- —_- From Leff first come first serve
For example :
When a=5 andb=10
a= atat+ *2/5++tbt+atb
a=atat+*2/5+ ++b+a+b : drop the value
a= 5+5*2/5+11+6+11
5+10/5+11+6+11
A Ditaliee 6 eli
5,
(Short cut such as +=, =, ‘= computation done in last)
b. Conversion of Algebraic expression into java expression
Keeping all the rules in the mind :
* is the only hidden sign in Algebra , never hide in Java
e Whenever there is numerator and denominator , put
parenthesis on both. It is compulsory.
c. Math Library function — Math is a name of class found in
java.lang package.
PAGE: 2
BY PANKAJ KUMAR CHOUDHARY — COPYRIGHT@2023ee ———————eS=—_—_——
Math.sqrt(x), Math.pow(x,y), Math.abs(x), Math rand
Math.ceil(x), Math.floor(x), Math, tt ae
d.
To input data from the Scanner class: import java.util
_ Scanner S = new Scanner(Syster
. Integer data : int x = S.nextInt();
ii, Float data: float f= S.nextFloat();
iii. Double data : double d = S.nextDouble( );
iv. String or sentence : String str = S.nextLine( );
y. To input a character : char ch = S.next().charAt(0);
vi. To input a word : String ed=S.next();
e. Conversion from one loop to another
i. for() loop to while loop or do.
ssn While loop to for loop
while....loop to for loop
iv. Making for loop , while loop and do...
loop
hile loop
while() loop as infinite
f£ Conversion from switch ...case to if else if statement and vice-versa
switch(ch)
case ‘u’: System.out.printIn(“Given character is a Vowel”);
break;
default : System.out.printin(“Not a vowel”);
}
Above switch case converted in if ...else
if(ch—a’ || ch—'e? || ch ='i’ || cho" || ch—"u")
{ System.out.printIn(“Given character is a Vowel”); }
else
{ System.out.printin(“Given character is not a Vowel”); }
Difference between switch ..case and if..else
Conversion from ternary operator (? : ) to if...else statement and vice-
versa
For example :
iffp > = 80)
grade="A’;
else if{ p >= 60 && p <=79)
grade ="B’;
=
PAGE :3
BY PANKAJ KUMAR CHOUDHARY ~ COPYRIGHT@2023Output Hints:
te
else iffp >= 40 && p <=59)
grade =’;
else ,
grade = ‘D’; at
Using ternary operator : ‘
char grade = (p>= 80) 2°A’ : (p >= 60 && p<= 79)? “B
&& p<=59) 2c’ D;
p>=40
. aepane of break , continue and return statement with example
of break :
<5; i+)
{ break;}
System.out.printin(i);
System.out.printin(“Thank You");
Will give output as
1
2
Thank You
Example of continue :
for(i=1; i<=5 ; +4)
{ if(i=3) { continue;}
System.out printin(i);
}
System.out.println(“Thank You”);
Will give output as
1
2
4
5
Thank You
. Output of nested loops and Patterns
WORA - Write Once Run Anywhere
NAN — Not A number
Coercion means casting. Automatic Data Conversion (Imlicit Casting) & Expicit
Casting
Ifa block is not given in any loop , it will repeat only one statement , no
matter whatever statement is on the same line.
If for loop or while loop has a semicolon like this given below:
for(int i= 1; i<=10; i++);
PAGE: 4
BY PANKAJ KUMAR CHOUDHARY ~ COPYRIGHT@2023Sysem.out.printin(“I=+i);
Tewill not repeat any statement. It will repeat internally and the
control will come out of the for loop when I value will become 11.
3. char x ="2’;
intz=x+2;
char m=
System.out.printin(“Z="+2);
System.out.printIn(“m="+m);
Note : When a character is added with integer value , character will convert
into its ascii code. ‘a’ ascii code is 97 , so the output will be
7=99
m=c
When an integer data stored in a character variable , a:
corresponding character.
4. How many times the given loop will be repeated ? Display the output:
intx=5;
while (++x <=20 ),
cht
if(x > 15)
break;
System.out printInX="+ x4);
\de will convert in its
System.out.printin(“Thank You”+ x);
Program List
1, Summing Series , Pattern Summing Series
i, S=2+4+6+8.
BL Sek octet
AHS = x42 +714 + 3/6 +...
iv. S= x'/21+ x/41 + x3/61 +...
Where n!= 1x2x3x4...xn
y.x!-x?+x3_x4
pee eat to n terms
s= 1+ (142) + (14243) + (14243+4)+
s=1 * (142) * (14243) * (1424344)
ix. s= 1 + (1*2) +(1*2*3) + (1#2*3*4)+
x. S=(1x2)/(1+2) + (1x2x3)/(14243) +
PAGE :5
BY PANKAJ KUMAR CHOUDHARY - COPYRIGHT@20232. Prime Numbers
toN.
display all the Prime Numbers from ? to .
d check whether a given number is a Prime
ae
seer Input a number an
Display in Pri ers from 1 toN
isplay all the twin Prime numbers f ° a
ba Bie ck given number is a Pal-Prime (Palindrome
Prime)
+3. HCF & LCM
_A-Display the Fibonacci series up to N term.
AY, 235,813.21, 01. pigs
5. i, Write a program to check whether a given number is a Perfect Number.
For example : (Sum of all the factors is equal to that number)
6=1+243
28=142+447414 f
Ai To check whether a given integer number is a Composite number or Prime
number
+6. Check for Amicable Number. Ni & N2 are Amicable if
N1 = sumoffactors(N2) && N2 = sumofFactors(N1)
7. Extracting Digits from an Integer number (_ 3 Steps to be
followed)
+ _ Display the sum of all the individual digits of a given number
4 Display the reverse of a given number and check whether a given
number is a Palindrome
»* Check whether a given number is a ArmStrong number
153=13+53+33
-*~ Convert a given Binary Number into its Decimal Number
1101 = 1 X2° + 1X2? + 0X21 41x29
+ Check whether a given number is an Automorphic number. For
example : 5 ->5? > 25, 6 >6? +36 +25 ->25? > 625
»* Check for Special Number : 145 = 1144! + 5!
7” Einding highest digit & lowest digit in a given integer number
For example : 9872 , Highest digit : 9, Lowest Digit : 2
-¢ AMagic Number is a number in which the eventual sum of digits
of the number is equal to 1. Example :172=14+742=10
10= 14+0=1
PAGE :6
BY PANKAJ KUMAR CHOUDHARY — copyp, IGHT@2023Hence 172 isa Magic number.
Write a Program to check whether a given number is a Magic number.
Nested Loop Pattern
i ii, ii, iv,
1 5 12345 12345
al) 45 1234 2345
123 345 123 345
1234 2345 12 “
12345 12345 1 5
¥ vi.
1 1
22 23
333 456
4444 yaoi
55555 111213 14 15
String Pattern
H HAPPY HAPPY ¥,
HA HAPP APPY By
HAP HAP PPY ee
HAPP HA HN APPY
HAPPY H By HAPPY .
H
AA
PPP
PPPP
NNN
PAGE :7,
BY PANKAJ KUMAR CHOUDHARY ~ COPYRIGHT@2023