0 ratings 0% found this document useful (0 votes) 3 views 19 pages Java pr1-6
The document outlines the specifications and requirements for a Java programming course, including hardware and software needs, as well as practical exercises and sample questions for students. It covers various programming concepts such as if statements, switch-case statements, loops, and logical operators. Additionally, it emphasizes the need for teachers to design their own questions to assess student understanding.
Copyright
© All Rights Reserved
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
Go to previous items Go to next items
Save Java pr1-6 For Later
Suggested Broad Quantity | Remark
Specification
| Hardware: Computer (i3-i5 preferable),
Computer RAM minimum 2 GB and
System onwards As per For all
2 | Operating Windows / Linux batch size | Experiments
dk 1.80 or above.
IX,
Remarks
Qty (ifany)
T [Computer Gomparer System 1
System i -
with broad | Uhh badic configure or
ications
2 | Software Notepad++ ,0°S box a =
3 | Any other
resource used
Practical Related Questions
Note: Belo’ are few sample questions for reference. Teacher must design
more such questions so ax to ensure the achievement of identified CO.
I. Write instailation directory path of your directory?
value of path environment variable?
folders created alter in
red as static. J
5. Program is named with class containing main method. Just
{Space for answer)
GE NPN FAM. Nile AON. AAMAN TAK WON DIA co
AK dd. PAN
34K ~ bin, tb, indude. eGo ALD,
302 IO. NL a
ie Hoard of Technical Falucation
MaharashirJava Programming (22412)
ae
98 OPK HOD ®e
pep LLL LL LOP DOD IOSD
Watarashira State Board of Technical Education
aha iJava Programming (22412)
if: if statement is simple decision-making statement, It is used to decide whether a
certain statement or block of statements will be executed or not. i.c. if a certain
condition is truc then the block will be executed otherwise not.
Syntax:
it{eondition)
{
1/ Statement to execute if the condition is true;
}
if-else: The if statement alone tells us that if a condition is true it will execute a
block of statements and if the condition false, else block will be executed.
Synta:
if(condition)
1/ Statement to execute if the condition is true;
}
else
{
4/ Statement to execute if the condition is false;
}
nested-if: A nested if is an if statement that is the target of another if or else.
‘Nested if statements means an if statement inside an if statement.
if(condition |!)
{
M execute when condition is true.
if(condition2)
{
M7 execute when condition? is true.
}
}
felse-if ladder: A user can decide among multiple options. The if statements are
executed from top down, When one of condition is true, the statement associated
with that if is executed, and the rest of the ladder is bypassed. If none of the
conditions is true, then the final else statement will be executed,
VIII. Resources required (Additional)
Nil
IX. Resources used (Additional)
Sr. ‘Name of oo Fe Remarks.
Be nace Broad Specification | Quantity (tany)
TT] computer BASIC Cenligacaho \
Sytem cot
21 orinter WO Laser seit ‘ .
‘Maharashira State Board of TechnicalJava Programming (22412)
AF Which of the following operator is used in if
8. Assignment operator (=) yscomparison operator (==)
~f PAL CUNRS.... ane
wDlOek..if..conditiba. 36, A6yeex
wif..n@lge..otatement.... the.
sod [Link]..the... else. black §
public... ClusS.. ae
a an sa. 0. Ching. gD
“Waharashira State Board of Technical Educationsing (22412)
nyt .00
‘Waharashira State Board of Techateal Education 2MAS Write output of code in the given space.
Program Code Output
1 public class NestedIfE> Tt
public class Nestec xample { Nunber 1S less than
public static void main(String args{]){ too
int num=70;
‘if( nums< 100 ){
[Link](“number is less than 100"); Number iS greater
iffmum> 50){ ¥
[Link] printin("number is greater than 50"); ran 90
}
}
2. class IfStatement {
public static void main(String{] args) { Wumber (9 positive
int number = 10;
if (number > 0) { Thid Statement i5
[Link],printIn("Number is positive."); always exe
; Ways X@ cated,
[Link] printIn("This statement is always
executed.");
}
L
4.2: Write a program to make the use of logical operators
(> Write a program to check no is even or odd,
d (Space for Answer)
-AMPOCK...;[Link] Ay :
Shas :
Nic. Stic. ~abih..g. Sting. at SEL)
ScanNel... enfin DEWE:.. AMEE. CR sen.
publi
|
‘Maharashtra Stare Board of Technical EducationJaya Programming (22412),
case vahie2
/ Statements
break; // break is optional
case valueN :
17 Statements
break; // break is optional
default :
1/ Statements
2. Conditional if (ternary operator
Syntax:
result = testStatement ? value! : value2;
VIII. Resources required (Additional)
Nil
IX. _ Resources used (Additional)
Se [Name ot | road Specification | Quantity | "yrmar®
1 [Compater BASIC Syotem i
syotem Contiguration -
2
Printer NO Lager Sext 1 i
X. Program Code: Teacher must assign a separate program statement to group of 3-
4 students.
‘Write any program using switch-case statement.
‘Maharashira State Board of Technical Educationning (22412)
XL Resutlt (Output of Code):
xn.
Related Questio
Note: Below given are few sample questions for reference. Teacher must design
< to ensure the achievement of identified CO.
. if break is not written for a case in switch case?
default case is executed?
iypes allowed in switch expression?
Write a program to make use of ternary operator.
(Space for Answer)
J.B. CODES... Ld. c
Pat Tend 9 ONE lh SCA on
chen. you want.
OD... OOL1iON,
Maharashira Stave Hoard of Technical Education 1samming (22412)
Fragile crane —
-~-pabliC...cLass....Tecnaty operatos. Example,
fo
‘Maharashira State Board of Technical Education 9Java Programming (22412)
XI.
Exercisi
UT Write Error/output of code in the given space.
Sr
Program Code
Error/Output
No.
public class SwitchCaseExamplel {
public static void main(String args{)){
int num=2;
switeh(num+2)
{
case 1:
[Link]("Case1: Value is; "tnum);
case 2:
[Link] printIn("Case2: Value is: "tnum);
case 3:
[Link]("Case3: Value is: "*mum);
default:
‘[Link]("Default: Value is: "+num);
1
Deloult, value i
public class Program {
public static void main(String] args) {
int value = 100;
switeh (value) {
case 100:
‘[Link](true);
break;
case 100:
[Link](true);
break;
‘Error:
Uuplicate. cage. label
4: caSe 100
<2 Write any program to check switch-
(Space for Answ
case statement using cl
acter datatype.
Maharashira Slate Board of Technical Education
20
BD PMA ARHa DASA MPHHHROMPHHOHMRTHHHSEHFEHOSDHHNHOPDJaya Programming
Decco
=a) pubic. dass. Char Sitch Bay
Public...stakic...void...nain
Char... rade.
“Wiaharashira State Board of Technical Education SSSIX. Resources used (Additional)
St Rameot | Brond Specification aaraat
T [computer System] Basic con iguation \ -
2 J erinter WP Laser Jet ' -
Program Code: Teacher must assign a separate program statement to group of 3-
4 students.
Develop a program to print command line argument using for loop.
XI. Result (Output of Code):
Waharashiva State Board of Technical Education 7Java Programming (22412) =
XI. Practical Related Questions
Note: Below given are few sample questions for reference. Teacher must design
more such questions so as to ensure the achievement of identified CO.
Ue When for loop will be terminated?
(2: Cain we write a for loop without initialization? If yes, give example.
30 Write a for loop to increment index variable by 2 in each iteration.
When for loop will be executed infinitely?
(Space for answer)
Te...100p....CONFINUES....12..24ECUEE..08..LaNg..08..ANIS...Conditian
AS... ACE's. TE...GOndiHON...cxmlnokes....bo.fl8@.,.ANG...1Q0.
Aeeminades.....and. the... rogam...conkinues..wsith..-the exe,
Stabemenk..after. Ane... top en _—
Yeo,.you..Can...ustite..o. far. loop..[Link] zation...
TA Dey All HHELER..[Link], 4. ANE. FOF! MOOD ALB ren
optional viii 2abion,.condiiOn....np...upda te.
Exam : — o
_Sy6tem. out. print
‘Maharachira Stave Board of TechnVa. wil “execule “ingini tly i
usays.. WAALS... AQ. MEL A.
NO. CEAK....OAT ANE. loop.
XU Exerc
2 Write any program using if condition with for loop.
Z Write any program to display pyramids of starsipatems using
increment decrement ~
e
&
@
e
oe
Ce
&
]©
e
s
e
&
©
&}
e
e
e.
e
«
&
«
(Space for Answer)
‘Miaharashes Suse Board of Techs Bo=tion xJava Programming (22412)
‘Maharachira State Board of Technical EducationVIL Resources required (Additional)
Nil
IN, Resources used (Additional
Name of | Broad Specification ‘Quantity
her [Compuler System wily
wwe confiqueation
WE Laser get \ -
Program Code: Teacher must assign a separate program statement to group of 3~
4 students.
Develop a program to use logical operators in do-while loop.
XL Result (Output of Code): :
‘Maharashira State Board of Technical Fducation a0Java Progra
XII. Practical Related Questions
Note: Below given are few sample questions for reference. Teacher must design
more such questions so as to ensure the achievement of identified CO.
MZ_ State difference between while lo-while loop.
Z In do-white loop termination condition is checked at_£nA _(begitfhing/end)
3- How many times do-while loop will be executed if condition is false?
(Space for answer)
2 whale. [Link] a
®.Condition.......checKed |..9).[Link]..xcauted..at:
FicSk... then..Statenent. sleatt..oKe,..thereale (..conditinn
Lone.
ed. Scop.
oa tral
J... [Link]..iS...Leqiaited at.
en) of while
Synto, = DSpian =
while Ceanditi [Link]:.
Sbakenentss 6 hile Coon Aitian):
Ne NGO [Link]...[Link]
£the.b®iA..
‘Maharashirs State Board of Technical FaucationJaya Peo
XII. Exerei
UG Write Error/output of code in the given space.
oo Program Code Error/Output
No.
class DoWhileBasics
{
public statie void main(String args{])
‘
int
do
1 t
‘[Link](a);
aeatl; //oratts
)
while(a<
1
‘class Test {
public static void mai
= 10);
BeOu MH eEn—
ring{) args)
while(true) { Infinite Lo op
[Link] print(1);
2. do {
[Link](2);
} while (false);
ie Bourd of Technical Faueation
Maharastra 8[Link]/c-loop-and-loop/
[Link]/wateh?v=IX6cLed730
:Ivww [Link]/16536/java-do-while-loop
tips://[Link]/2015/03/do-while-loop-in-java-with-example/
(Space for answer)
oSystem,.ouk prin...
Sadhile. .Ci.ce50d....
Maharashira State Board of Tech
a