Category: 5th Semester
java solution 2016 Batch pre board Answers
2016 Batch Asian 2.Write a program passing parameter in applet.Write complete HTML file to include applet.
1 2 3 4 5 6 7 8 |
import java.applet.Applet; import java.awt.Graphics; public class UseParam extends Applet{ public void paint(Graphics g){ String str=getParameter("msg"); g.drawString(str,50, 50); } } |
3.Explain two key swing features. Swing offers two key features: Swing components are lightweight and don’t rely on peers. Swing supports a pluggable look and feel. The three PLAFs available to all users are Metal (default), Windows, and Motif. 4.Write a swing program […]
Continue ReadingJava 2 old Papers Solution 2018 || BIM STUDY NOTES
year 2018 Create a HTML document that contains header information of a page and include this HTML as a header file in header.html
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> </head> <body> <center> <h1>Orchid International College</h1> <h3>Gaushala, Kathmandu</h3> </center> </body> </html> |
include.jsp <html> <body> <%@include file = “header.html” %> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p></body> </html> 3. Create […]
Continue ReadingJava 2 old Papers Solution 2017 || BIM STUDY NOTES
Year 2017 Group B 2.Write a program to display records from the table “employee” that contains (id, name, post and salary) inside the database “testdb”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import java.sql.*; public class Ques2_2017 { public static void main(String[] args) { String url = "jdbc:mysql://localhost:3306/testdb"; String uname = "root"; String pwd = ""; try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, uname, pwd); String sql = "select * from employee"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()) { System.out.println(rs.getString("id")); System.out.println(rs.getString("name")); System.out.println(rs.getString("post")); System.out.println(rs.getString("salary")); } }catch(Exception ex) { System.out.println(ex); } } } |
Q.no 3 Create jsp page to display all odd numbers from 10 to 50
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <title>Printing odd numbers from 10 to 50</title> </head> <body> <% out.print("<b> odd numbers from 10 to 50</><br>"); for( int i=10;i<=50;i++) { if(i%2!==0){ out.print("<br><b>"+i+"</b>"); } } %> </body> </html> |
Q.no 5 Write a servlet to find the reverse of a string.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import java.applet.*; import java.awt.event.*; import java.awt.*; public class T2017_5 extends Applet implements ActionListener{ Panel p1,p2; Label l1,l2,l3; TextField t1,t2,t3; Button b1,b2; public void init(){ p1=new Panel(); p2=new Panel(); p1.setLayout(new GridLayout(3,2)); p2.setLayout(new FlowLayout()); l1=new Label("Number 1"); l2=new Label("Number 2"); l3=new Label("Result"); t1=new TextField(); t2=new TextField(); t3=new TextField(); t3.setEditable(false); p1.add(l1); p1.add(t1); p1.add(l2); p1.add(t2); p1.add(l3); p1.add(t3); add(p1); add(p2); b1=new Button("+"); b2=new Button("-"); p2.add(b1); p2.add(b2); } public void start(){ b1.addActionListener(this); b2.addActionListener(this); } public void actionPerformed(ActionEvent e){ int a=Integer.parseInt(t1.getText()); int b=Integer.parseInt(t2.getText()); if(e.getSource()==b1){ int c=a+b; t3.setText(" "+c); } else if(e.getSource()==b2){ int c=a-b; t3.setText(" "+c); } } } |
Group […]
Continue ReadingAIW 2016 & 2016 Model Question || BIM STUDY NOTES
2016 Model Question Q.no 4 2016 1.ii 1.v
Continue ReadingAIW 2017 old Papers Solution
Year 2017 Q.no 2 Q.no 3 Q.no 4
Continue Reading