Professional Documents
Culture Documents
Q1. Write A Java Program To Design A Following GUI (Use Swing) (Marks 30)
Q1. Write A Java Program To Design A Following GUI (Use Swing) (Marks 30)
Write a java program to design a following GUI (Use Swing) [Marks 30]
Ans
l1=new JLabel("First Name "); l2=new JLabel("last Name "); l3=new JLabel("Address "); l4=new
JLabel("mobile No ");
bg.add(f);
p1.add(l5);
p1.add(m);
p1.add(f);
p1.setLayout(new GridLayout(1,3));
p2=new JPanel();
l6=new JLabel("Your Interests "); c1=new JCheckBox("Computer"); c2=new JCheckBox("Sports"); c3=new
JCheckBox("Music");
p2.add(l6);
p2.add(c1);
p2.add(c2);
p2.add(c3);
p2.setLayout(new GridLayout(1,4));
p3=new JPanel();
p3.add(b2);
add(p);
add(p1);
add(p2);
add(p3);
setSize(300,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
new Slip8();
}
Q2. Write a JavaScript program to design student registration form and perform following
validation:
Ans
<html>
<head>
<script>
function validate()
sname=document.getElementById("nm").value;
smobile=document.getElementById("mb").value;
saddress=document.getElementById("add").value;
scity=document.getElementById("ct").value;
sstate=document.getElementById("st").value;
spin=document.getElementById("pin").value;
if(sname==""||smobile==""||saddress==""||scity==""||sstate==""||spin=="")
return false;
}
else if(!sname.match(/^[A-Za-z]+$/))
return false;
else if(!smobile.match(/^\d{10}$/))
return false;
else if(!spin.match(/^\d{6}$/))
return false;
alert("Valid");
return false;
</script>
<body>
<form name="frmStudent">
</table>
</form>
</body>
</html>
Q3. Write a Vb.net program to accept number from user into the TextBox. Calculate the square root of
that number also convert the entered number into binary number and display result into the Message
Box [Marks 20]
Ans
Dim n As Integer
Dim rm As Integer
n = CInt(TextBox1.Text)
sqr = Math.Sqrt(n)
While n
rm = n Mod 2
n=n\2
End While
MessageBox.Show("Square Roor :" & sqr & " Binary Number : " & str1)
StrReverse(str1)
End Sub
End Class