COMPUTER PRACTICAL EXAM
text file download link
for simple view click here
Q.1 Creating student Information form using form tag and table tag.
<html>
<head>
<Title> Student Information Form </Title>
</head>
<body bgcolor-pink>
<h1 align=center> STUDENT DATA </h1>
<form action=abc.html method=post>
<table>
<tr> <td> First Name</td> <td> <input type=text> </td> </tr>
<tr> <td>Middle Name </td> <td> <input type=text> </td> </tr>
<tr><td Last Name </td> <td> <input type=text> </td> </tr>
<tr> <td> Gender </td> <td> <input type=radio name=r1> Male <input type=radio name=r1> Female </td>
<tr> <td> Hobby </td> <td> <input type=checkbox> Travelling <input type=checkbox> Music <input type=checkbox> Reading </td> </tr>
<tr> <td> Address </td> <td> <textarea> </textarea> </td></tr>
<tr> <td> City </td>
<td><select> <option> Vadodara </option>
<option> Surat </option>
<option> Anand </option>
</select>
</td> </tr>
<tr> <td> </td> <td> <input type=submit value=Submit> <input type=reset value=Reset>
</td></tr>
</form>
</body>
</html>
Q.2 to change background color.
<html> <head> <Title> Change Background Color</Title> </head> <body> <center> <a href=""onMouseOver="document.bgColor=('Red')" onMouseOut="document.bgColor=('Cyan')"> Red</a><br> <a href=""nMouseOver="document.bgColor=('Orange')" onMouseOut="document.bgColor =('yellow')"> Orange</a><br> <a href=""onMouseOver="document.bgColor=('magenta')" onMouseOut="document.bgColor =('olive')"> magenta</a><br> </center> </body> </html>
Q.3 to display Web browser name and its version.
<html>
<body bgcolor=lightGreen>
<script>
document.write("Web Browser is "+navigator.appName);
document.write(" Version is "+ parseInt(navigator.appVersion));
</script> </body>
</html>
Q.4 Write a java program to display given number is odd or even.
class oddeven
{
public static void main (String args[])
{
int no=10;
if (no%2 == 0)
{
System.out.print(no + " is even number ");
}
else
{
System.out.print(no + " is Odd Number ");
}
}
}
Q.5 to print 1 to 10 using for loop.
class loop1
{
public static void main (String []args)
{
for(int i=1 ;i<=10;i++)
{
System.out.println(i);
}
}
}
Q.6
to print the following patterns.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
class loop4
{
public static void main (String []args)
{
for (int i=1 ;i<=5; i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}
}
Q.7 to Print the following patters.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
class loop5
{
public static void main (String []args)
{
for (int i=1 ;i<=5; i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}
}
Q.8 to Use of Polymorphism.
Write a Java program to Use of Polymorphism class poly
class poly
{
static void printline()
{
for(int i=0;i<=50;i++)
{
System.out.print("@");
}
System.out.println();
}
static void printline(int n)
{
for(int i=0;i<=n;i++)
{
System.out.print("#");
}
System.out.println();
}
static void printline(char ch, int n )
{
for (int i=0;i<=n;i++)
{
System.out.print(ch);
}
System.out.println();
}
}
public class polym
{
public static void main (String []s)
{
poly.printline(0);
poly.printline(40);
poly.printline('=',30);
}
}
Q.9 to compute average of 10 numbers using array.
class array3
{
public static void main (String args[])
{
double nos[]={10.5,1,2,3,4,5,6,7,8,9};
double sum=0, avg;
System.out.println ("List of values :");
for (int i=0;i<10;i++)
{
System.out.println (nos[i]);
sum = sum + nos[i];
}
avg = sum/10;
System.out.println("Average of given numbers is " + avg );
}
}
Q.10 to print Reverse String.
class string4
{
public static void main (String args[])
{
String str=new String("I love India");
System.out.println("Original String : " + str);
System.out.println("Reverse String : " + revstr(str));
}
static String revstr (String str)
{
int len=str.length();
byte byteAry[]=new byte[len];
byteAry = str.getBytes();
for(int i=0, j=len-1; i<len/2; i++, j--)
{
byte temp=byteAry[i];
byteAry[i]=byteAry[j];
byteAry[j]=temp;
}
return new String (byteAry);
}
}