Wednesday, 20 November 2019

ASSIGNMENT ON PYTHON LISTS CLASS-XI (CS)






Q1. Find the output of the following:
(i)           a=[1,2,3,4,5,6,7,8,9]
          print(a[::2])

(ii)                   a=[1,2,3,4,5]
          print(a[3:0:-1])
 
(iii)                    arr = [1, 2, 3, 4, 5, 6]
         for i in range(1, 6):
         arr[i - 1] = arr[i]
         for i in range(0, 6): 
                        print(arr[i], end = " ")

(iv) list1 = [‘physics’, ‘chemistry’, 1997, 2000];
       list2 = [1,2,3,4,5,6, 7];
       print “list1[0]”, list1[0]
(v)
aList = [123, ‘xyz’, ‘zara’, ‘abc’, 123];
bList = [2009, ‘manni’];
aList.extend (bList)
print “Extended List :”, aList;
Q2. Differentiate between append() and extend() functions of list.
Q3. Consider a list:
 list1 = [6,7,8,9]
What is the difference between the following operations on list1:
a. list1 * 2
b. list1 *= 2
c. list1 = list1 * 2




Q4. Write Python statements to create the following lists:
(i) A list of 5 fruit names and name it as fruit.
(ii) A list of 5 city names and name it as City.
(iii) A list containing 3 strings and 2 integers and name it as Mixed.
(iv) A list containing 3 integers and a list of 2 strings and name it as Box.
(v) A list of 10 random integers each in the range 10 to 50 and name it as R10.
(vi) A list of 10 random floating point numbers in the range 10.00 to 49.99 and name it as F10.
Q5.. Assuming that A is a list, differentiate between:
(i) A[2] and A[2:]
(ii) A[2:] and A[:2]
(iii) A[2::] and A[::2]
(iv) A*3 and [A,A,A]


Q6. Consider the lists A and B given below and state the values (True/False) of the expressions that
follow:
A=[5, 3, 8]
B=[A, 8, 66, 45]
(i) A in B                      (ii) 'A ' in B                  (iii) [A] in B                  (iv) [5, 3, 8] in B
(v) 8 in B                      (vi) [8] in B                  (vii) [A, 8] in B             (viii) 66 in B
(ix) 45 in B                   (x) A not in B



Q7.. Write output of the following code segment:
a=[1,2,3,2,1]
for x in a:
print(a[x],end= '*')
Q8.Consider the lists A and B given below and write the output of the statements that follow:
A=[5, 3, 8]
B=[A, 8, 66, 45, 'A',['A',A], ["nested", "lists"]]
(i) print(A) (ii) print(B) (iii) print(A[0])
(iv) print(A[0:]) (v) print(A[:0]) (vi) print(B[0])
(vii) print(B[0][1]) (viii) print(B[0][1:]) (ix) print(B[4])
(x) print(B[5])

Q9. What will be the output of the following statements?
(i).
list1 = [12,32,65,26,80,10]
list1.sort()
print(list1)
(ii)
list1 = [12,32,65,26,80,10]
sorted(list1)
print(list1)
(iii)
list1 = [1,2,3,4,5,6,7,8,9,10]
list1[::-2]
list1[:3] + list1[3:]
(iv)
 list1 = [1,2,3,4,5]
list1[len(list1)-1]

Q10. Consider the following list myList. What will be the elements of myList after the following two
operations:
 myList = [10,20,30,40]
i. myList.append([50,60])
ii. myList.extend([80,90])

Tuesday, 12 November 2019

SOLVED HTML PROGRAMS CLASS-X




PROGRAM 1 : HTML PROGRAM TO DISPLAY SPECIAL CHARACTERS.
SOLUTION:
<HTML>
<HEAD>
 <TITLE> Special characters </TITLE>
 </HEAD>
 <BODY>
 <P> &lt; and &gt; and &amp; are special characters that are displayed
 Using escape sequence. </P>
 </BODY>
</HTML>
PROGRAM 2:  HTML PROGRAM TO DISPLAY TEXT BY CHANGING BASE FONT SIZES.
SOLUTION:
<HTML>
 <HEAD>
 <TITLE> Base Font </TITLE>
 </HEAD>
<BODY>
This text is being displayed in default font size as no basefont size hase been set as yet.
<BASEFONT size =5>
This text has base font size =5.
</BODY>
</HTML>
 
PROGRAM 3 HTML PROGRAM USING TABLES
SOLUTION:
 
<html>
<head>

</head>
<body>

<table border="1">
  <tr>
    <td>
      <p>This is a paragraph</p>
      <p>This is another paragraph</p>
    </td>
    <td>This cell contains a table:
      <table>
        <tr>
          <td>1</td>
          <td>2</td>
        </tr>
        <tr>
          <td>3</td>
          <td>4</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>This cell contains a list
      <ul>
        <li>car</li>
        <li>bike</li>
        <li>bicycle</li>
      </ul>
    </td>
    <td>HELLO</td>
  </tr>
</table>

</body>
</html>


PROGRAM 4: HTML PROGRAM FOR CREATING THE TABLE
SOLUTION : <html><body><table border=1>
<tr><th colspan=6>Time Table</th></tr>
<tr> <th rowspan = 6>Hours</th>
<th>Mon</th><th>Tue</th><th>Wed</th>
<th>Thu</th><th>Fri</th></tr>
<tr><td>Science</td><td>Maths</td>
<td>Science</td><td>Maths</td>
<td>Arts</td></tr>
<tr><td>Social</td><td>History</td><td>English</td>
<td>Social</td><td>Sports</td></tr>
<tr><th colspan=5> Lunch</th></tr>
<tr><td> Science</td><td>Maths</td>
<td>Science</td><td>Maths</td>
<td rowspan =2> Project</td></tr>
<tr><td>Social</td><td>History</td><td>English</td>
<td>Social</td></tr>
</table>
</body>
</html>

PROGRAM  5: HTML PROGRAM FOR A COMPLETE WEB PAGE
SOLUTION:
<HTML>
<HEAD><TITLE> wild life in India </TITLE></HEAD>
<BODY bgcolor=yellow LINK="black" VLINK="green">
<CENTER><H1> <FONT COLOR="maroon">INDIAN ELEPHANT</FONT>
 </H1></CENTER>
<IMG SRC="elephant.png" ALIGN="right" HEIGHT=225 WIDTH=250>
<p>The Indian elephant (Elephas maximus indicus) is one of three recognised subspecies of the
Asian elephant and native to mainland Asia. Since 1986, Elephas maximus has been listed as
Endangered by IUCN as the population has declined by at least 50% over the last three
generations, estimated to be 60–75 years. Asian elephants are threatened by habitat loss,
degradation and fragmentation".
 <p> See Also :
 <UL>
 <LI><A HREF="one.html">Sri Lankan Elephant</A>
 <LI><A HREF="two.html">sumatran Elephant</A>
 <LI><A HREF="three.html">Borneo Elephant</A>
 <LI><A HREF="four.html">African elephant</A>
 </UL>
 <CENTER>
 <TABLE BORDER=2 BORDERCOLOR="blue" width=25% height=175>
<font color =blue><CAPTION>Threats To Elephants</CAPTION></font>
<TR> <TD> 1<TD> Illegal Hunting</TR>
<TR><TD> 2<TD>Industrialisation</TR>
<TR><TD> 3<TD> Habitat Loss</TR>
<TR><TD> 4<TD> Fragmentation</TR>
<TR><TD> 5<TD>Disease</TR>
</TABLE><BR>For further enquiries and reservations <A
HREF="mailto:abc@xyz.com">Contact Us</A>
</CENTER></BODY></HTML>

PROGRAM 6 :  HTML PROGRAM USING LISTS, IMAGE AND LINKS
SOLUTION : <HTML>
<html><HEAD><TITLE> Gaming</TITLE></HEAD>
<BODY bgcolor = “yellow”>
<basefont face = “verdana”
<H2 ALIGN=center><font color =”maroon” face = “arial bold”>Computer Gaming</font>
</H2>
<IMG SRC="image1.jpg" HEIGHT=150 WIDTH=200 ALIGN="right">
<P><B>A personal computer game(also known as a computer game or PC game) is a game
played on a personal computer, rather than on a video game console or arcade machine.
Computer games have evolved from the simple graphics and gameplay of early titles like
Spacewarl, to a wide range of more visually advanced titles.
<P>Basically there are four types of computer games:<BR>
<OL><LI>Strategy
<LI> First person shooters
<LI> 3rd person views
<LI> Racing
</OL>
<TABLE ALIGN=center BORDER=2 bordercolor="green">
<Caption> Top Games</Caption>
<TR><td>Warcraft</td>
<TD>Strategic game</TD>
<TD><img src = war.jpg></TD>
<td>Call of Duty</td>
<TD>First Person shooter</TD>
<TD><img src = call.jpg></TD>
</tr>
</table>
<HR SIZE=2 COLOR=red>
<FONT SIZE=2><P ALIGN=center>FOR FURTHER ENQUIRES :<A
HREF="game.html"></A>
</BODY></HTML>
PROGRAM 7 :  HTML PROGRAM USING TABLES, LISTS AND IMAGES
SOLUTION:
<html>
<head>
<title> Handmade Cards </title>
</head>
<body bgcolor="pink">
<center>
<font face="Arial Bold" size="5" color ="Red">
<b>HANDMADE CARDS</b>
</font>
<br>
<font size=3>Handmade cards offers custom made cards as per your requirements for
everyone </font><BR>
<img src ="cards.jpg" border ="3" height=175 width=175>
</center>
<font face = "Arial Bold" size=4 color="Red">
Categories of Cards Offered</font>
<font size=3>
<ol type = 1>
<li> General Cards </li>
 <ul type="square">
 <li> Thinking of You </li>
 <li> Missing You </li>
 <li> Friends Forever </li>
 </ul>
 <li> Specific Cards </li>
 <ul type ="circle">
 <li> Happy Birthday </li>
 <li> Happy Diwali </li>
 <li> Happy Anniversary </li>
 </ul>
</ol>
<i><center>You can also order flowers through our site</center></i>
<table width =20% align = center border = 3 bordercolor = green cellpadding = 10
cellspacing = 2>
<caption>
<b>PRICE LIST</b>
</caption>
<tr>
 <th> Bouquet Type </th>
 <th> Price </th>
</tr>
<tr>
 <td> Flower Galore </td>
 <td> Rs. 200 </td>
</tr>
<tr>
 <td> Flower Shower </td>
 <td> Rs. 300 </td>
</tr>
<tr>
 <td> Flower Power </td>
 <td> Rs. 400 </td>
</tr>
</table>
<br>
<center>
<a href ="person.html">
<img src = "link.jpg" border = 2 height=50 width=50>
<br>
Personalize The Card
</a>
</center>
</font>
</body>
<HTML>


Sunday, 4 August 2019

HTML PROGRAMS ON LIST


AssignmentClass-X


Q-1 Write a program for the following:  

Details of Students
  1. Kavya Sharma
    • Passed 10th in 1999
    • Passed 12th in 2001
    • Passed B.COM in 2004
    • Passed MCA in 2008
  2. Ambar
    • Passed 10th in 1998
    • Passed 12th in 1999
    • Passed B.A. in 2002
  3. Aashi
    • Passed 10th in 1997
    • Passed 12th in 1998
    • Passed BCA in 2001
  4. Anjali Gupta
  5. Parth Upreti
Q-2 Write an HTML code to view the following output:




Notes:
1. title of the page should be input and output devices
2. Heading should be in red color, bold and italics.
3. Place the horizontal ruler as shown.
4. Font size of list items should be 12 and color should be in blue color.
5. Headings “Input devices and output devices” should be in purple color

Monday, 8 July 2019

ASSIGNMENT-1 JAVA NETBEANS CLASS-12


CLASS-XII
ASSIGNMENT-1  OF JAVA PROGRAMMING


A. Output Finding Questions:
Q.1. Write the output of the following code:
int x,y=0;
for(x=1;x<=5;++x)
y=x++;
--y  

Q.2. Write the output of the following code
Int f=1,i=2;
do{
f*=I;
}while(++i<5);
System.out.println(f); 


Q.3. What will be the value of j and k after execution of the following code:
int j=10,k=12;
if(k>=j)
{
k=j;
j=k;

Q.4. How many times ,the following loop gets executed?
 i=0;
while(i>20)
{
//statements

Q,5, How many times ,the following loop gets executed?
i=0;
do{
//statements
}while(i>20); 

Q.6. What will be the contents of TextField after exec uting the following statement:
int num=4;
num=num+1;
if(num>5)
jTextField1.setText(Integer.toString(num));
else
jTextField1.setText(Integer.toString(num*4)); 

Q.7.find the output
int number1=7,number2=8;
int second=73;
if(number1>0||number2>5)
if(number1>7)
jTextField1.setText(“code worked”);
else
jTextField1.setText(“code might work”);
else
jTextField1.setText(“code will not work ”); 

Q.8. How many times will the following loop get executed?
 x=5; y=36;
while(x<=y)
{
x+=6;
}

Q.9. What will be the content of the jTextArea1 after executing the following code?
 int num=1;
do
{
jTextArea1.setText(Integer.to String(++num)+”\n”);
num=num+1;
}while(num<=10); 

Q.10. Give the output for the following code fragment:
v=20;
do{
jOptionPane.showMessageDialog(numm,v+””);
}while(v<50);
jOptionPane.showMessageDialog(numm,v+””); 

Q.11. Give the value after executing following java code.Also find how many times the following
loop will execute?
int a=10;
int b=12;
int x=5;
int y=6;
while(a<=b)
{
if(a%2==)
x=x+y;
else
x=x-y;
a=a+1;

Q.12.What will be the output produced by following code fragment?
float x=9;
float y=5;
int z=(int)(x/y);
switch(z)
{
 case 1:x=x+2;
case 2: x=x+3;
default: x=x+1;
}
System,.out.println(“value of x:”+x); 

Q.13. Predict the output of the following code fragment:
int i,n;
n=0;i=1;
do
{
 n++;i++;
}while(i<=5); 

Q.13. What will be the values of x and y after executing the following expressions.
 int x=20,y=35;
 x= y++ + x++;
 y= ++y + ++x; 

Q.14. What will be the values of x and y after executing the following expressions.
 int y=-1;
 System.out.println(“x:”+(-y--));
 System.out.println(“y:”+y);


Q.15. What will be the values of x and y after executing the following expressions.
 int x = 45;
 x = x + x++;
 System.out.println(x);
 int y = 45;
 y = y++ + y;
 System.out.println(y); 

Q.16. What values will be assigned to the variable ua,ub,uc and fail after execution of the
following program segment:
int i=0,ua=0,ub=0,uc=0,fail=0;
while(i<=5){
switch(i++)
{
case 1:++ua;
case 2:++ub;uc++;break;
case 3;
case 4:++uc;ua++;ub++;break;
default:++fail;

Q.17. Predict an output of the following code fragment:
 int i=1,j=0,n=0;
while)i<4)
{
for(j=1;j<=I;j++)
{
n+=1;
i=i+1;
}
System.out.println(n);

Q..18. Give the output of the following code:
int m=100;
while(m>0)
{
if(m<10)
break;
m=m-10;
}
System.out.println(“m is “+m); 

B. Error Finding Questions:
Q.1. The following cade has some errors. Rewrite the corrected code:
 int  i=2,j=5;
while j>i
{jTextField1.getText(“j is greater”);
j--;++ I;
}
JOptionPane.showMessageDialog(“Hello”);

Q.2. Identify the errors:
switch(ch)
{
case ‘a’:
case ‘A’:
case ‘e’:
case ‘E’:
case ‘i’:
case ‘E’:
case ‘u’:
case ‘U’:++vowels;
break;
default:++others;


Q.3. int j=5;
i==j+5;
if(i=j)
jTextField1.setText(“I and j are equal”);
else
 jTextField1.settext(“ I and j are unequal”);


Q.4. Rewrite the code after making correction. Underline the correction.
Int sum;value;inct;
Int i
For(i==0;i<=10;i++)
Sum=sum+I;
Inct++;


Q.5. The following code has some error(s).Rewrite the correct code underlining all the corrections
made.
Int y=3;
Switch(y)
{
 case 1: System.out.println(“yes its one”);
case >2: System.out.println(“yes it is more than two”);
break;
case else: System.out.println(“invalid number”);


Q.6. Rewrite the following java code after underlining the correction made:
int x==0;
int n=Integer.parseInt(jLabel1.getText());


Q.7. find out errors if any:
M=1;n=0;
For(;m+n<19;++n)
System.out.println(“hello”);
M=m+10;


Q.8. The following code has some error(s).Rewrite the correct code underlining all the
corrections made.
int y=6,p;
Do
{
y=3.14*y;
p=y%10;
If p=2
System.out.print(“two”);
While(y>1)


C. Rewrite the following program code using a for loop:
Q1.  int I,sum=0;
while(I<10)
{
sum+= I ;
I+=2;
}


Q.2. Rewrite the following code using while loop:
int i,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=I;++j)
System.out.print(j);
}
System.out.println();
}

Q.3. Write a equivalent while loop for the following code:
int sz=25;
for(int i=0,sum=0;i<sz;i++)
sum+=I;
System.out.println(sum);


Q.4.Rewrite the following if-else segment using switch –case statement
char ch=’A’;
if(ch==’A’)
System,out.println(“Account”);
if((ch==’C’)||(ch==’G’))
System.out.println(“Admin”);
if(ch==’F’)
System.out.println(“advisor”);


Q..5. Rewrite the following code using while loop
int i, j;
for(i=1,j=2;i<=6;i++,j+=2)
System.out.println(i++);
System.out.println(“finished!!!”);


Q.6. Rewrite the following code using for loop.
int i=0;
while(++i<20)
{
if(i==8)
break;
System.out.println(i++);
}


Q.7.Rewrite the code using switch statement:
if(k==1)
day=”Monday”;
else if(k==2)
day=”Tuesday”;
else if (k==3)
day=”Wednesday”;
else day=”-“;
}


Q8. What will be the output of :.
 if (aNumber >= 0)
 if (aNumber == 0)
 System.out.println("first string");
 else System.out.println("second string");
 System.out.println("third string");
If aNumber is (i) 0 (ii) 2

Q9. What will be the output of the program?
 int count = 1;
 do
{
System.out.println("Count is: " + count);
 count++;
 } while (count < 11);

Q10. What will be the output of the program
int i=1,j=-1;
switch(i)
{
case 1,-1: j=1;
case 2 : j=2;
default :j=0;
}
Q11.  What will be the output of the program?
int i = 1, j = 10;
do
{
 if(i > j)
 {
 break;
 }
 j--;
} while (++i < 5);
System.out.println("i = " + i + " and j = " + j);