NPTEL Programming In Java Assignment 10 Answers 2022 (Week10)
NPTEL Programming In Java Assignment 10 Answers 2022 :- Here All The Questions and Answers Provided to Help All The Students and NPTEL Candidate as a Reference Purpose, It is Mandetory to Submit Your Weekly Assignment By Your Own Understand Level
Are you looking for the Assignment Answers to NPTEL Programming In Java Assignment 10 Answers 2022? If Yes You are in Our Great Place to Getting Your Solution, This Post Should be help you with the Assignment answer to the National Programme on Technology Enhanced Learning (NPTEL) Course “NPTEL Programming In Java Week 10 Assignment Solution 2022”
NPTEL Programming In Java Assignment 10 Answers 2022 (Week10)
NPTEL Programming In Java
From My Side : With the expansion of knowledge and Communication Technology, there’s a desire to develop massive and complicated package. Further, those package ought to be platform freelance, web enabled, straightforward to switch, secure, and robust. to satisfy this demand object-oriented paradigm has been developed and supported this paradigm the Java artificial language emerges because the best programming atmosphere. Now, Java artificial language is being employed for mobile programming, web programming, and plenty of alternative applications compatible to distributed systems. This course aims to hide the essential topics of Java programming in order that the participants will improve their skills to address the present demand of IT industries and solve several issues in their own filed of studies.
With the growth of Information and Communication Technology, there is a need to develop large and complex software. Further, those software should be platform independent, Internet enabled, easy to modify, secure, and robust. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment. Now, Java programming language is being used for mobile programming, Internet programming, and many other applications compatible to distributed systems. This course aims to cover the essential topics of Java programming so that the participants can improve their skills to cope with the current demand of IT industries and solve many problems in their own filed of studies.
CRITERIA TO GET A CERTIFICATE
This course can have Associate in Nursing unproctored programming communication conjointly excluding the Proctored communication, please check announcement section for date and time. The programming communication can have a weightage of twenty fifth towards the ultimate score.
- Assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
- ( All assignments in a particular week will be counted towards final scoring – quizzes and programming assignments).Â
- Unproctored programming exam score = 25% of the average scores obtained as part of Unproctored programming exam – out of 100
- Proctored Exam score =50% of the proctored certification exam score out of 100
UNPROCTORED PROGRAMMING EXAM SCORE >=10/25 AND PROCTORED EXAM SCORE >= 20/50.Â
CHECK HERE OTHERS NPTEL ASSIGNMENTS ANSWERSÂ
BELOW YOU CAN GET YOUR NPTEL Programming In Java Assignment 10 Answers 2022? :
NPTEL Programming In Java Assignment 10 Answers 2022 (Week10)
Q1. Which of these is a protocol for breaking and sending packets to an address across a network?
a) TCP/IP
b) DNS
c) Socket
d) Proxy Server
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: a) TCP/IP
Q2. Which of the following statement(s) is/are false?
a) DatagramSocket is a UDP endpoint API
b) DatagramSocket is a TCP server API
c) ServerSocket is a TCP server API
d) ServerSocket is a TCP client API
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: b), d)
Q3. In the socket programming, for an IP address, which can be used to find the host name and IP address of a client/server?
a) The ServerSocket class
b) The Socket class
c) The InetAddress class
d) The Connection interface
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: c) The InetAddress class
Q4. Which of the following package contains classes and interfaces for networking?
a) java.io
b) java.util
c) java.net
d) javax.swing
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: c) java.net
Q5. In the following URL, identify the Resource name?
https://xyz.ac.in
NPTEL Programming In Java Assignment 10 Answers 2022 (Week10)
a) https
b) xyz.ac.in
c) ac.in
d) https://xyz.ac.in
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: b) xyz.ac.in
Q6. Which of the following is/are transport layer protocol(s)?
a) TCP
b) UDP
c) HTTP
d) FTP
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: a), b)
Q7. The package, which is required to be imported for the JDBC programming?
a) java.net
b) java.sql
c) java.lang
d) java.io
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: b) java.sql
Q8. Which of the following is/are valid Data Definition Language(DDL) command(s)?
a) SELECT
b) INSERT
c) UPDATE
d) ALTER TABLE
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: d) ALTER TABLE
Q9. In JDBC, all raw data types(including binary documents or images) should be read and uploaded to the database as an array of
a) int
b) char
c) byte
d) String
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: c) byte
Q10. Once a JDBC driver has been registered, which of the following method is used to make a database connection?
a) getConnection(String url, String userID, String password)
b) setConnection(String url, String userID, String password)
c) Connect(String url, String userID, String password)
d) Connect(string url, string userID, string password)
SHOW Answer By SciShowEngineer
Answer By SciShowEngineer: a) getConnection(String url, String userID, String password)
Programming In Java Assignment 10:
- The following code needs some package to work properly. Write appropriate code to import the required package(s) in order to make the program compile and execute successfully.
import java.sql.*;
import java.lang.*;
public class Question101 {
public static void main(String args[]) {
try {
Connection conn = null;
Statement stmt = null;
String DB_URL = “jdbc:sqlite:/tempfs/db”;
System.setProperty(“org.sqlite.tmpdir”, “/tempfs”);
// JDBC Codes in the hidden section
// Open a connection
conn = DriverManager.getConnection(DB_URL);
System.out.print(conn.isValid(1));
conn.close();
// JDBC Codes in the visible section
}
catch(Exception e){ System.out.println(e);}
}
}
2. Write the JDBC codes needed to create a Connection interface using the DriverManager class and the variable DB_URL. Check whether the connection is successful using ‘isAlive(timeout)‘ method to generate the output, which is either ‘true’ or ‘false’.
import java.sql.*;
import java.lang.*;
import java.util.Scanner;
public class Question102 {
public static void main(String args[]) {
try {
Connection conn = null;
Statement stmt = null;
String DB_URL = “jdbc:sqlite:/tempfs/db”;
System.setProperty(“org.sqlite.tmpdir”, “/tempfs”);
conn = DriverManager.getConnection(DB_URL);
System.out.print(conn.isValid(1));
conn.close();
// Private test case
Scanner sc = new Scanner(System.in);
int s=sc.nextInt();
if(s==7){
conn.close();
System.out.print(conn.isValid(1));
}
}
catch(Exception e){ System.out.println(e);}
}
}
3. Due to some mistakes in the below code, the code is not compiled/executable. Modify and debug the JDBC code to make it execute successfully.
import java.sql.*; // All sql classes are imported
import java.lang.*; // Semicolon is added
import java.util.Scanner;
public class Question103 {
public static void main(String args[]) {
try {
Connection conn = null;
Statement stmt = null;
String DB_URL = “jdbc:sqlite:/tempfs/db”;
System.setProperty(“org.sqlite.tmpdir”, “/tempfs”);
// Connection object is created
conn = DriverManager.getConnection(DB_URL);
conn.close();
System.out.print(conn.isClosed());
}
catch(Exception e){ System.out.println(e);}
}
}
4.
Complete the code segment to create a new table named âPLAYERSâ in SQL database using the following information.
Column | UID | First_Name | Last_Name | Age |
Type | Integer | Varchar (45) | Varchar (45) | Integer |
import java.sql.*;
import java.lang.*;
public class CreateTable {
public static void main(String args[]) {
try {
Connection conn = null;
Statement stmt = null;
String DB_URL = “jdbc:sqlite:/tempfs/db”;
System.setProperty(“org.sqlite.tmpdir”, “/tempfs”);
// Open a connection
conn = DriverManager.getConnection(DB_URL);
stmt = conn.createStatement();
// The statement containing SQL command to create table “players”
String CREATE_TABLE_SQL=”CREATE TABLE players (UID INT, First_Name VARCHAR(45), Last_Name VARCHAR(45), Age INT);”;
// Execute the statement containing SQL command
stmt.executeUpdate(CREATE_TABLE_SQL);
ResultSet rs = stmt.executeQuery(“SELECT * FROM players;”);
ResultSetMetaData rsmd = rs.getMetaData();
System.out.println(“No. of columns : ” + rsmd.getColumnCount());
System.out.println(“Column 1 Name: ” + rsmd.getColumnName(1));
System.out.println(“Column 1 Type : ” + rsmd.getColumnTypeName(1));
System.out.println(“Column 2 Name: ” + rsmd.getColumnName(2));
System.out.println(“Column 2 Type : ” + rsmd.getColumnTypeName(2));
System.out.println(“Column 3 Name: ” + rsmd.getColumnName(3));
System.out.println(“Column 3 Type : ” + rsmd.getColumnTypeName(3));
System.out.println(“Column 4 Name: ” + rsmd.getColumnName(4));
System.out.println(“Column 5 Type : ” + rsmd.getColumnTypeName(4));
stmt.close();
conn.close();
}
catch(Exception e){ System.out.println(e);}
}
}
5. Complete the code segment to rename an already created table named âPLAYERSâ into âSPORTSâ.
import java.sql.*;
import java.lang.*;
public class RenameTable {
public static void main(String args[]) {
try {
Connection conn = null;
Statement stmt = null;
String DB_URL = “jdbc:sqlite:/tempfs/db”;
System.setProperty(“org.sqlite.tmpdir”, “/tempfs”);
// Open a connection
conn = DriverManager.getConnection(DB_URL);
stmt = conn.createStatement();
// The statement containing SQL command to create table “players”
String CREATE_TABLE_SQL=”CREATE TABLE players (UID INT, First_Name VARCHAR(45), Last_Name VARCHAR(45), Age INT);”;
// Execute the statement containing SQL command
stmt.executeUpdate(CREATE_TABLE_SQL);
// Write the SQL command to rename a table
String alter=”ALTER TABLE players RENAME TO sports;”;
// Execute the SQL command
stmt.executeUpdate(alter);
ResultSet rs = stmt.executeQuery(“SELECT * FROM sports;”);
ResultSetMetaData rsmd = rs.getMetaData();
System.out.println(“No. of columns : ” + rsmd.getColumnCount());
System.out.println(“Column 1 Name: ” + rsmd.getColumnName(1));
System.out.println(“Column 1 Type : ” + rsmd.getColumnTypeName(1));
System.out.println(“Column 2 Name: ” + rsmd.getColumnName(2));
System.out.println(“Column 2 Type : ” + rsmd.getColumnTypeName(2));
System.out.println(“Column 3 Name: ” + rsmd.getColumnName(3));
System.out.println(“Column 3 Type : ” + rsmd.getColumnTypeName(3));
System.out.println(“Column 4 Name: ” + rsmd.getColumnName(4));
System.out.println(“Column 5 Type : ” + rsmd.getColumnTypeName(4));
stmt.close();
conn.close();
}
catch(Exception e){ System.out.println(e);}
}
}