Practice Question and Answer

Q: How to create a basic text file in php? 813 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

$filename = "/home/user/guest/newfile.txt";$file = fopen( $filename, "w" );if( $file == false ){echo ( "Error in opening new file" );exit(); }fwrite( $file, "This is a simple test\n" );fclose( $file );

Q: What is the difference between mysql_connect and mysql_pconnect? 1696 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

There is a decent page in the php manual on the subject, in short mysql_pconnect() makes a persevering association with the database which implies a SQL join that don't close when the execution of your script closes. mysql_connect()provides just for the database new association while utilizing mysql_pconnect , the capacity would first attempt to locate a (relentless) connection that is as of now open with the same host, username and password. On the off chance that one is found, an identifier for it will be returned as opposed to opening another connection... the connection with the SQL server won't be terminated when the execution of the script ends. Rather, the link will stay open for future use.

Q: What is a Node.js? 1127 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

Node.js is a framework for web applications built on Google Chrome's JavaScript Engine(V8 Engine). Node.js is comes with runtime environment on which a cript based on javascript can be interpreted and executed (It is analogus to JVM to JAVA byte code). This runtime environment allows to execute a JavaScript code on any machine outside a browser. Because of this runtime of Node.js, JavaScript is now can be executed on server also. Node.js is provides a rich library of various javascript modules which eases the developement of web application using Node.js to greater extents.

Q: What are the Advantages of Node.js? 704 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

Aynchronous and Event Driven - All APIs of Node.js library area unit aynchronous that's non-blocking. It basically means that a Node.js based mostly server not waits for a API to return information. Server moves to next API when calling it and a notification mechanism of Events of Node.js helps server to induce response from the previous API decision. Very Fast - Node.js library is very fast in execution of code. Single Threaded but highly Scalable - Node.js uses a single threaded model with event looping. Node.js uses a single threaded program and same program can services much larger number of requests than traditional server like open source. No Buffering - Node.js applications never buffer any data. These applications simply output the data in faster.

Q: Is Node.js is a single threaded application? 851 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

Node.js uses a single threaded model with event looping.

Q: What is a REPL in context of Node.js? 1328 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

Read - Reads users input, parse the input into JavaScript data-structure and stores in memory Eval - Evaluates the data structure Print - Prints the result Loop - Loops the above command until user press ctrl-c twice

Q: How does Node.js prevents blocking code? 1167 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

By providing callback function. Callback function gets called whenever corresponding event triggered.

Q: What is the purpose of Buffer class in Node.js? 1120 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

Buffer class could be a global class and may be accessed in application without importing buffer module. A Buffercould be a quite an array of integers and corresponds to a raw memory allocation outside the V8 heap. A Buffer can not be resized.

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully