2
Q:

main() {

int i;

printf("%d",scanf("%d",&i)); // value 10 is given as input here

}

A) 1 B) 2
C) 3 D) 4

Answer:   A) 1



Explanation:

Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.

Subject: Java
Q:

What is a ResultSet ?

Answer

A table of data representing a database result set, which is usually generated by executing a statement that queries the database.


 


ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1661
Q:

What is DriverManager ?

Answer

DriverManager is a class in java.sql package. It is the basic service for managing a set of JDBC drivers.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1814
Q:

What are the steps required to execute a query in JDBC?

Answer

First we need to create an instance of a JDBC driver or load JDBC drivers, then we need to register this driver with DriverManager class. Then we can open a connection. By using this connection , we can create a statement object and this object will help us to execute the query.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1751
Q:

What is JDBC Driver ?

Answer

The JDBC Driver provides vendor-specific implementations of the abstract classes provided by the JDBC API. This driver is used to connect to the database.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1608
Q:

What is JDBC ?

Answer

JDBC technology is an API (included in both J2SE and J2EE releases) that provides cross-DBMS connectivity to a wide range of SQL databases and access to other tabular data sources, such as spreadsheets or flat files. With a JDBC technology-enabled driver, you can connect all corporate data even in a heterogeneous environment.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1702
Q:

How to identify a given positive decimal number as even/odd without using % or / operator ?

Answer

You may be very good at coding,but if you questioning how on earth you could solve this problem.Then here is a solution. If you remember the good old days of our primary school then the solution is easy,"division is a matter of iterative subtraction".


public class TestEvenOdd {
public static void main(String arg[ ]){
int num=6;
int result=num;
while(result>=2){
result=result-2;
}
if(result==1){
System.out.println("The number is odd");
}else{
System.out.print("The number is even");
}
}
}

Report Error

View answer Workspace Report Error Discuss

Subject: Java

3 5232
Q:

What will be the output of the following code snippet?

Object s1 = new String("Hello");
Object s2 = new String("Hello");
 
if(s1 == s2) {
  System.out.println("s1 and s2 are ==");
}else if (s1.equals(s2)) {
  System.out.println("s1 and s2 are equals()");
}

Answer

Answer : s1 and s2 are equals()


 


Explanation :



 

Report Error

View answer Workspace Report Error Discuss

Subject: Java

8 15879
Q:

What is classloader?

Answer

The classloader is a subsystem of JVM that is used to load classes and interfaces.There are many types of classloaders e.g. Bootstrap classloader, Extension classloader, System classloader, Plugin classloader etc.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1874