Keyword

Result: 191 questions

JavaScript is the same as Java.

Quiz

How do you declare a JavaScript variable?

Quiz

Is JavaScript case-sensitive?

Quiz

Compare Java & Python

Answer:

Criteria Java Python
Ease of use Good Very Good
Speed of coding Average Excellent
Data types Static typed Dynamically typed
Data Science & machine learning applications Average Very Good
View

What is the use of enumerate() in Python?

Answer:

Using enumerate() function you can iterate through the sequence and retrieve the index position and its corresponding value at the same time.
>>> for i,v in enumerate([‘Python’,’Java’,’C++’]):
print(i,v)
0 Python
1 Java
2 C++

View

What is JSON? How would convert JSON data into Python data?

Answer:

JSON – stands for JavaScript Object Notation. It is a popular data format for storing data in NoSQL
databases. Generally JSON is built on 2 structures.
1. A collection of <name, value> pairs.
2. An ordered list of values.
As Python supports JSON parsers, JSON-based data is actually represented as a dictionary in Python. You can convert json data into python using load() of json module.

View

How instance variables are different from class variables?

Answer:

Instance variables: are the variables in an object that have values that are local to that object. Two objects of the same class maintain distinct values for their variables. These variables are accessed with “object-name.instancevariable-name”.
class variables: these are the variables of class. All the objects of the same class will share value of “Class variables. They are accessed with their class name alone as “class- name.classvariable-name”. If you change the value of a class variable in one object, its new value is visible among all other objects of the same class. In the Java world, a variable that is declared as static is a class variable.

View

Does Python supports interfaces like in Java? Discuss.

Answer:

Python does not provide interfaces like in Java. Abstract Base Class (ABC) and its feature are provided by the Python’s “abc” module. Abstract Base Class is a mechanism for specifying what methods must be implemented by its implementation subclasses. The use of ABC’c provides a sort of “understanding” about methods and their expected behaviour. This module was made available from Python 2.7 version onwards.

View

What are Accessors, mutators, @property?

Answer:

Accessors and mutators are often called getters and setters in languages like “Java”. For example, if x is a property of a user-defined class, then the class would have methods called setX() and getX(). Python has an @property “decorator” that allows you to ad getters and setters in order to access the attribute of the class.

View

How node.js works?

Answer:

Node.js works on a v8 environment, it is a virtual machine that utilizes JavaScript as its scripting language and achieves high output via non-blocking I/O and single threaded event loop.

View

Why node.js is quickly gaining attention from JAVA programmers?

Answer:

Node.js is quickly gaining attention as it is a loop based server for JavaScript. Node.js gives user the ability to write the JavaScript on the server, which has access to things like HTTP stack, file I/O, TCP and databases.

View

What are the pros and cons of Node.js?

Answer:

Pros:

a) If your application does not have any CPU intensive computation, you can build it in Javascript top to bottom, even down to the database level if you use JSON storage object DB like MongoDB.

b) Crawlers receive a full-rendered HTML response, which is far more SEO friendly rather than a single page application or a websockets app run on top of Node.js.

Cons:

a) Any intensive CPU computation will block node.js responsiveness, so a threaded platform is a better approach.
b) Using relational database with Node.js is considered less favourable

View

What is the difference between Node.js vs Ajax?

Answer:

The difference between Node.js and Ajax is that, Ajax (short for Asynchronous Javascript and XML) is a client side technology, often used for updating the contents of the page without refreshing it. While,Node.js is Server Side Javascript, used for developing server software. Node.js does not execute in the browser but by the server.

View

What does it mean “non-blocking” in node.js?

Answer:

In node.js “non-blocking” means that its IO is non-blocking.  Node uses “libuv” to handle its IO in a platform-agnostic way. On windows, it uses completion ports for unix it uses epoll or kqueue etc. So, it makes a non-blocking request and upon a request, it queues it within the event loop which call the JavaScript ‘callback’ on the main JavaScript thread.

View

What is REPL in context of Node?

Answer:

REPL stands for Read Eval Print Loop and it represents a computer environment like a window console or unix/linux shell where a command is entered and system responds with an output. Node.js or Node comes bundled with a REPL environment. It performs the following desired tasks.

  • Read - Reads user's input, parse the input into JavaScript data-structure and stores in memory.

  • Eval - Takes and evaluates the data structure

  • Print - Prints the result

  • Loop - Loops the above command until user press ctrl-c twice.

View

Which of the expressions listed below will result in "false"?

true    ? "true" : "false"
false   ? "true" : "false"
nil     ? "true" : "false"
1       ? "true" : "false"
0       ? "true" : "false"
"false" ? "true" : "false"
""      ? "true" : "false"
[]      ? "true" : "false"

Answer:

In Ruby, the only values that evaluate to false are false and nilEverything else – even zero (0) and an empty array ([]) – evaluates to true.

This comes as a real surprise to programmers who have previously been working in other languages like JavaScript.

(Thanks to Ruby Gotchas for this question.)

View

What is XML Parser?

Answer:

XML Parser is used to convert from XML document into an XML DOM object which can be written in Javascript.

View

Which of the following is a true statement for JavaScript callbacks?

Quiz

Which of the following is the output of the below JavaScript code?

function getFunc() {
    var a = 7;
    return function(b) {
        alert(a+b);
    }
}
var f = getFunc();
f(5);
Quiz

When executed, the below JavaScript code will pop up three alerts. Identify the corret answer?

var a = 6;
function test() {
    var a = 7;
    function again() {
        var a = 8;
        alert(a);  // A
    }
    again();
    alert(a);  // B
}
test();
​alert(a);​  // C
Quiz

© 2017 QuizBucket.org