IT - 12th - Lab Manuals - Subject Specific
IT - 12th - Lab Manuals - Subject Specific
3: 1:
SPECIFIC
SUBJECT
Fundamentals
Database
SKILLS
Concepts
of
MANUAL)
(LAB
Java
PART B
RDBMS
17
Tool
Ans. between
Managerment
Practical
5. 4. 3. 2. 1.
Item_Id
5. 4. 3. 2. 1. 4006 4005 4004 4003 4002 4001
Selet SelecSelectSelect Display Display
Display Display
Display CONCEPTS-RDBMS
DATABASE
Degree TOOL
Select*
23:
namedistinctnarme * System).
from from name
allthosedistinct
item those all and Rakul
the the
from from PL
B codeItem
item (name) item records items items
records NB PL TP TB SP Cardinality. He has
order item item order made
recently
whose where
where fromwhere in in
by by
descending ascending Pencil Black
NotebookDrawing
Pencil Tooth
Paste Brush
Tooth Soap a
price quantity Write table
price item; name; started
price quantity Name
is t"Item"
he
19 desc; between
is is
order queries working
between is
order more given
>3000
of 20 than of givenbelow. on
p:ice. name.
20 to Quantity RDBMS
and and 100. 3000
7344 8000 10000 2000 8000 5000 below: He
100: <9000: and is
(Relational not
less able
than
Price to
2.67 34.67 1.25 138.90 34.50 71.23 differentiate
UNIT 1
9000. Data-Base
20 Lab Manual Information Technology - 12th
Practical 24: Write the SQL statements for thetable "Trainee" given below:
No Name Monthly_fee Gender Branch id Date of joining
1012 Anmandeep 30000 M A01
2012-01-02
1102 Avisha 25000 F A02
2009-03-24
1103 Ekant 30000 M A02 2011-11-04
1049 Arun 40000 M A02 2009-05-06
1025 Amber 30000 M A02 NULL
1106 Eisha 40000 F A05 2010-11-12
1017 Nikita 35000 F A03 2012-12-04
1108 Arleena 30000 F A03 NULL
1101 Shakthi 25000 M A04 2011-03-23
1. Display the names of applicants whose monthly fee is either 30000 or 40000.
2. Display names and annual fee of all male applicants.
3. Display name, branch id of those who joined in the year 2009.
4. Display the details of those trainees whose date of joining is not
mentioned.
5. Display trainee details in descending order of names.
6. Change the monthly fees of Arleena to 40000.
7. Delete trainee details of those whose mnonthly fee is
30000.
8. Delete those records where the name starts with letter "A"
and ends with letter
"A".
Ans.
1. Select name from players where training fee in (25000,
like "%ball%":
40000) and ganme name
2. Select name from players order by name;
3. Select name, gender, game name from players
where not (game name
= "badminton") ;
4. Sele* from players wheregender="F" and date of join between
2011-01-01"
and "2011-12-31";
5. Select distinct game name from player order by game
name desc;
Subject Specific Skills (Lab Manua) 21
6. Update player set training foe-50000 where name "Arleena",
7. Delete from plaver whee training_ fee=30000;
8. Delete fom player whene game_ name like "GR" and gender= "M";
hactical 25: What willbe the output of the following SQL. statement with reference
to the "Student" table given below:
Table: STUDENT
No. NameStipend Stream Avg-Marks Grade Class
Karan 400,00Medical 78,5 B 12B
2 Divakar 450,00Commerce 89.2 A 11C
3 Divya 300.00 Commerce 68,6 12C
4 Arun 350,00Humanittes 73.1 B 12C
5 Sabina 500,00Non-medical 90.6 A 11A
John 400.00Medical 75.4 B 12B
7 Robert 250.00Humanities 64,4 11A
8 Rubina 450.00 Non-medical 88.5 A 12A
Vikas 500.00 Non-medical 92.0 A 12A
10 Mohan 300.00Commerce 67.5 12C
Stroam percentage
Commece 68.6
Practical 27: In a Fashion Store's database, there is a table 'Customer' as given below.
Table: Customer
Acc No Cust Name Cust City Cust Phone Open Bal
1001 Dharmesh Ambala 9710557614 10000
1002 Saniya Patna 8223545233 15000
1003 Joe New Delhi 9972136576 13000
1004 Mrinal New Delhi 9321305453 12000
1005 kshaan Agra 9809876798 19000
With reference to, the above given table, what will be the output of following
commands
(a) Select Cust name from Customer where Open bal<=15000;
(b) Select Cust name from Customer where Cust City like %a%';
(c) Select Acc No from Customer where Cust City='New Delhi';
(d) Select Cust name, Acc No from Customer where Acc no is not Null;
Ans.
(a)
Cust Name
Dharmesh
Saniya
Joe
Mrinal
(b)
Dharmesh
|Saniya
|Ikshaan
(d)
Acc No Cust Name
1001 Dharmesh
1002 |Saniya
1003 Joe
1004 Mrinal
1005 Ikshaan
UNIT3
FUNDAMENTALS OFJAVA
Practical 28: White a program to accept integer number from user and print the number
Ans.
import java.util.Scanner;
public class HelloWorld {
Output
Enter a number: 30
You entered: 30
Practical 29: VWrite a program to accept two numbers from the user and find the sum
of numbers.
Ans.
class Example {
24
Subject Specific Skills (Lab Manual) 25
sum R nl t n2:
Output
Enter two numbers
34 42
The sum is: 76
Practical 30: Write a program to swap the numbers without using the third variable.
Ans.
public class Swap {
Output
First number = 23
Second number = 78
Result
First number = 78
Second number = 23
26 Lab Manual Information
Technology
Practical 31: Write a program to accept number from the user and
-
12th
number is even or odd. check whether
Ans.
import java.util.Scanner;
public class Example {
public static void main (String [] args) {
Output
Enter a number: 22
22 is even
Practical 32: VWrite a program to accept a number from the user and check whether
an alphabet is vowel or consonant.
Ans.
import java.util.Scanner;
public class Example {
public static void main (String[] arg3) {
26
Manua) 27
Subject Specific Skills (Lab
System. out.println (ch + is consonant"):
Output
Enter a character:
a is vONel
Practical 33: Write a program to accept three numbers from the user and find the
largest number.
Ans.
public class Example {
public static void main (String [] args) {
else
number");
System, out.println(n3 + " is the largest
28 Lab Menual Informnt.lon lhohnology 12u
Output
Enter a lat number 7
Enter a 2nd number : 3
Enter a 3rd number: 9
9 1a the largest number
olse
leap true;
else
leap false;
if (leap)
System. out.println (yoar + " is a leap yoar, ");
else
System, out.println (year + " Ls not a leap yoar");
)
29
Subject Specific Skills (Lab Manual)
Output
2022 is not a leap year
Practical 35: Write a program to check whethera number is positive or negative.
Ans.
public class Example {
double n1 = 18;
else
Output
18 is a positive nunber
Practical 36: Write a program to check whether a character is alphabet or not.
Ans.
public class Example {
args) {
public static void main (String[]
char c = 'a';
Output
a ls an alphabet
long f =l;
for (int i = 1; <= num; +i)
f = f * i;
Output
Factorial of a number = 3628800
int len=str.length () ;
Subject Specific Skills (Lab Manual)
System. out.println(len):
Output -
6
Practical 39: Wite a program to check whether the string is palindrome or not.
Ans.
class Example {
public static void main (string[] args) (
String str = RADAR", r str = *;
int strLength;
else {
System, out.println (str + " is not a Palindrome") :
Output
RADAR is a Palindrome
int num = 3;
boolean £ = false;
£or (int i = 2; i <= num / 2; it+) {
if (num % i = 0) {
£= true;
break ;
if (!£)
System.out.println (num + is a prime number") ;
else
Output
3 is a prime number
char ch;
Double numberl, nunber2, result;
switch (ch) {
case +:
Case
Case
case ' / :
result = numberl / number2 ;
System. out.println(number1 + " / + number2 + " = " + result):
break;:
34 Lab Manual Information Technology -12th
default:
input.close () ;
Output
1. +
2. -
3. *
4. /
Select Choice +
Enter frst number 14
Enter second number 6
14 *6 = 20
Practical 42: Write a Java program to print the Fibonacci Series by getting input of
the number of terms in the series during run time.
0112358 13 2134
Ans.
import java.util.Scanner;
class Fibonacci
num3=num1+num2 :
numl=num2;
num2=num3;
System. out. print (num3) :
System. out.print ("\t") ;
Practical 43: Write a program to find the average of the given array 27, 38, 57, 84, 64.
Ans.
public class Example {
Output -
The average is: 54.0
Practical 44: Write a program to concatenate two different strings.
Ans.
public class Example {
public static void main (String [] args) {
String strl="Ashish ";
String str2="Anand" ;
36 Lab Manual Informention hahnology
12
Output
Ashish Anand
Practical 45: Write a program to convert the string into uppercase format.
Ans.
public class Example {
public static void main (StringI] args) {
String str-"anurag":
String upper=str.toUpperCase () ;
Output
ANURAG
Practical 46:Write a Java program to find the Area of aRectangle by geting the inputof
length and breadth from the user during run tÉme.
Ans:
import java.util.Scanner;
public class AreaOfRectangle {
public static void main (String args [])
Practical 47: Write a Java program to display character A to Z using for loop.
Ans:
public class CharactersAtoZ {
public static void main (String [ args) {
char c;