difference between synchronous and asynchronous code example

Example 1: difference between synchronous and asynchronous in node js

// Example 1 - Synchronous (blocks)
var result = database.query("SELECT * FROM hugetable");
console.log("Query finished");
console.log("Next line");


// Example 2 - Asynchronous (doesn't block) 
database.query("SELECT * FROM hugetable", function(result) {
    console.log("Query finished");
});
console.log("Next line");

Example 2: synchronous vs asynchronous encryption

Encryption can be synchronous or asynchronous. Synchronous cryptography is mostly used for data at rest, and also for digital signature. Asynchronous cryptography is usually used for data in transit and in cases where encryption and decryption keys need to be shared or exchanged.

Example 3: The below diagram shows which of the following transmission mode? * Captionless Image Asynchronous Transmission Synchronous Transmission Isochronous Transmission None of the above

The below diagram shows which of the following transmission mode? *
Captionless Image
Asynchronous Transmission
Synchronous Transmission
Isochronous Transmission
None of the above

Tags:

Misc Example