# Node Quiz Questions 1. Which of the following belongs to psedu-global in Node.js ? - [ ] require - [ ] module.exports - [x] both - [ ] none 2. Select globals from given options in Node.js - [ ] console - [ ] setTimeout() - [ ] process - [x] All of the above 3. In Nodejs what is use of underscore(_) variable in REPL session - [ ] to store result - [ ] to get last command used - [x] to get the last result - [ ] to list all previous commands 4. Which of the following is true about chaining streams ? - [ ] Chaining is a mechanism to connect output of one stream to another stream and create a chain of multiple stream operations. - [ ] Chaining is normally used with piping operations. - [x] Both of the above - [ ] None of the above 5. Which of the following is true about RESTful web services ? - [ ] Webervices based on REST Architecture are known as RESTful web services. - [ ] Webservices uses HTTP methods to implement the concept of REST architecture - [x] Both of the above - [ ] None of the above 6. Which statement execute the code of sample.js in node environment ? - [ ] nodejs sample.js - [x] node sample.js - [ ] run sample.js - [ ] exec sample.js 7. The Node.js modules can be exposed using - [ ] module.expose - [ ] module.require - [x] module.exports - [ ] module.export 8. List all globally installed packages for Node.js using - [ ] npm list --all - [x] npm list -g - [ ] npm list - [ ] npm list -i 9. Which of the following class is used to create and consume custom events in Node.js ? - [x] EventEmitter() - [ ] Events - [ ] nodeEvents() - [ ] All of the above 10. Node.js is by default - [ ] Synchronous - [ ] Multi-threaded - [x] Asynchronous - [ ] All of the above 11. Node.js supports which of the following platform ? - [ ] Windows - [ ] Macintosh - [ ] Unix/Linux - [x] All of the above 12. What is the default scope in Node.js application ? - [ ] Global - [x] Local - [ ] Global Function - [ ] Local to object 13. Which of the following core node module is used to create a web server ? - [ ] fs - [ ] url - [ ] connect - [x] http 14. How to import module in Node.js ? - [x] Using the require() function - [ ] Using module.import - [ ] Using imclude() function - [ ] Using app.use() 15. Which of the following is a GUI-based debugging tool for Node.js ? - [ ] Core node debugger - [ ] Console - [ ] REPL - [x] Node Inspector 16. Which of the followings are web application frameworks for Node.js ? - [ ] Express - [ ] Geddy - [ ] Locomotive - [x] All of the above 17. Which of the following template engines can be used with Node.js ? - [ ] Jade - [ ] EJS - [ ] Handlebars - [x] All of the above 18. Get absolute path of index.js from server.js file as both these files are located in same directory. - [ ] path.join(__dirname, 'index.js') - [ ] __dirname + '/index.js' - [ ] path.resolve(__dirname, 'index.js') - [x] All of the above 19. Get relative path of index.js from server.js file as both these files are located in same directory(node). - [ ] ./index.js - [ ] ./index - [ ] ../node/index.js - [x] All of the above 20. Which core module can be used to get pathname from `localhost:3000/users/register?name=altcampus` url - [ ] path - [x] url - [ ] http - [ ] os 21. Which one of the following can be used to get name from query string specified in `localhost:3000/users/register?name=altcampus` url ? - [x] url.parse(url, true).name - [ ] url.split(url).name - [ ] url.parse(url).name - [ ] url.split(url, true).name 22. Which of the following command is used to start a Node REPL session ? - [x] node - [ ] node start - [ ] node repl - [ ] node console 23. Which of the following module is not a built-in node module ? - [ ] zlib - [ ] https - [ ] dgram - [x] fsread 24. Which of the following method of fs module is used to truncate a file ? - [ ] fs.delete() - [ ] fs.remove() - [x] fs.ftruncate() - [ ] All of the above 25. Which of the following code print the platform of operating system ? - [ ] os.platform - [x] os.platform() - [ ] os.getPlatform() - [ ] sys.platform() 26. Which of the following method is used to return the current working directory of the process ? - [x] cwd() - [ ] pwd() - [ ] Both - [ ] None of the above 27. Which of the following Javascript engine is used by Node in core ? - [x] Chrome V8 - [ ] Microsoft Chakra - [ ] SpiderMonkey - [ ] JavacriptCore 28. Which of the following shortcut command is used to kill a process in Node.js ? - [ ] Ctrl + B - [ ] Ctrl + K - [x] Ctrl + C - [ ] Ctrl + Z 29. Which of the followings are a valid form of route path ? - [ ] Regular Expressions - [ ] String patterns - [ ] String - [x] All of the above 30. What can be exported using module.exports ? - [ ] Only Objects - [ ] Only Functions - [ ] Variables & Array - [x] Functions, Objects, Arrays, or anything you assign to the module