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 synchronization and why is it important ?

Answer

With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 3135
Q:

Difference between Swing and Awt ?

Answer

AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1873
Q:

What are pass by reference and passby value ?

Answer

Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1653
Q:

What is the purpose of garbage collection in Java, and when is it used ?

Answer

The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1883
Q:

What is the difference between an Interface and an Abstract class?

Answer

An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1630
Q:

Is the JDBC-ODBC Bridge multi-threaded ?

Answer

No. The JDBC-ODBC Bridge does not support multi threading. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won't get the advantages of multi-threading.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 3074
Q:

What is the fastest type of JDBC driver ?

Answer

Type 4  (JDBC Net pure Java Driver) is the fastest JDBC driver.  Type 1 and Type 3 drivers will be slower than Type 2 drivers (the database calls are make at least three translations versus two), and Type 4 drivers are the fastest (only one translation).

Report Error

View answer Workspace Report Error Discuss

Subject: Java

1 2858
Q:

What are the different JDBC drivers available ?

Answer

There are mainly four type of JDBC drivers available. They are:

Type 1 : JDBC-ODBC Bridge Driver - A JDBC-ODBC bridge provides JDBC API access via one or more ODBC drivers. Note that some ODBC native code and in many cases native database client code must be loaded on each client machine that uses this type of driver. Hence, this kind of driver is generally most appropriate when automatic installation and downloading of a Java technology application is not important. For information on the JDBC-ODBC bridge driver provided by Sun.

Type 2: Native API Partly Java Driver- A native-API partly Java technology-enabled driver converts JDBC calls into calls on the client API for Oracle, Sybase, Informix, DB2, or other DBMS. Note that, like the bridge driver, this style of driver requires that some binary code be loaded on each client machine.

Type 3: Network protocol Driver- A net-protocol fully Java technology-enabled driver translates JDBC API calls into a DBMS-independent net protocol which is then translated to a DBMS protocol by a server. This net server middleware is able to connect all of its Java technology-based clients to many different databases. The specific protocol used depends on the vendor. In general, this is the most flexible JDBC API alternative. It is likely that all vendors of this solution will provide products suitable for Intranet use. In order for these products to also support Internet access they must handle the additional requirements for security, access through firewalls, etc., that the Web imposes. Several vendors are adding JDBC technology-based drivers to their existing database middleware products.

Type 4: JDBC Net pure Java Driver - A native-protocol fully Java technology-enabled driver converts JDBC technology calls into the network protocol used by DBMSs directly. This allows a direct call from the client machine to the DBMS server and is a practical solution for Intranet access. Since many of these protocols are proprietary the database vendors themselves will be the primary source for this style of driver. Several database vendors have these in progress.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1927