Gulp is yet another tool from open source community to automate repetitive tasks in web development. While tools like bower, npm (Node Package Manager) helps us to download and configure re-usable packages in our application, Gulp helps us to automate many of the time consuming repetitive client side tasks.
These are tasks like bundling and minifying scripts and style sheets, compiling less or sass to css styles, deploying files to servers, image compressing, etc. So, in simple terms Gulp is a task runner tool while tools like Bower, npm are package managers.
Gulp is built upon Node.js and it already has a strong community that builds various plugins for performing various tasks. There are currenlty more than 3000+ plugins available here which makes almost every possible tasks we can think of can be automated. The gulp tasks are writted in javascript file called gulpfile.js which will be executed by Gulp tool.
There are lot of tasks which were taking lot of time of UI developers which were no productive such as - sass to css conversation, making HTML templates, Minify of CSS and JS, Images optimization, setting localhost, refreshing page.
So, gulpjs/gruntjs help in making these tasks automated, it is a one time task to installed these and set the commands and than you are good to go.
These help in saving the time, making your development workflow more organized.
Below are the Top 30+ Gulp multiple choice questions
(1)Streams give higher flow control. Is this True or False?
(i)True
(ii)False
Answer:-True
(2)Which plug-in has optimizers and compressors?
gulp-changed
gulp-plumber
gulp-imagemin
gulp-watch
Answer:-gulp-imagemin
(3)The different kinds of Streams include ______________.
(i)readable,writable,divide, classic, transcend
(ii)readable, writable, divide, correspond, transform
(iii)readable,writable,duplex, classic, transform
(iv)readable,writable,divide, check, transform
Answer:-readable,writable,duplex, classic, transform
(4)While installing gulp, the first installation step would be ________.
$npm install gulp g savedev
$npm install gulp --save-dev
$npm install gulp g
$npm install gulp g --save-dev
Answer:- $npm install gulp g
(5)How does installing Gulp globally help?
can draw reference within grunt easily
None of the options
Helps to run gulp command from any project folder
all files in any directories can be easily mapped
All the options
Answer:-Helps to run gulp command from any project folder
(6)Streams which play vital role in gulp, has its origin from __________.
Unix
Node.js
Gulpfile.js
None of the Options
All the options
Answer:-Unix
(7)Which Streams provide ability to both read and write?
All the options
Classic
Transform
None of the Options
Duplex
Answer-Transform
(8)Between Grunt and Gulp, which is relatively fast?
Both are of same speed
Neither of the same
Grunt
Gulp
Answer:-Gulp
(9) The default task representation in gulp will be like _________.
gulp.call('default',function(){ 'default'});
gulp.task('default',function(){ });
gulp.call('default',function(){ 'd',void});
gulp.call('default',function(){ 'd',null});
Answer:-gulp.task('default',function(){ });
(10)Streams are represented as _________.
None of the Options
.dest()
.src()
.pipe()
All the options
Answer:-.pipe()
(11)While installing gulp with $npm install gulp --save-dev, what does --save-dev represents?
Missed out components of global installation will be taken here
Installs Gulp as a development dependency andpackage.json updated
Ensures CLI installation
triggers dependency between project and cli
Answer:-Installs Gulp as a development dependency andpackage.json updated
(12)Streams are Asynchronous. Is this True or False?
False
True
Answer:-True
(13)Before installation of Gulp, installation of _____________ acts as pre-requisite.
Bower.js
Brocolli.js
Node.js-----
Grunt.js
Gulp.js
Answer:-Node.js
(14)How many types of Streams are available?
5
4
6
3
3
Answer:-5
(15)Which plugin notifies whenever there is any change in file?
gulp-notify
gulp-watch
gulp-plumber
gulp-timber
Answer:-gulp-watch
(16)Which among the following helps to compile into .CSS format?
gulp-less
gulp-sass
Both the options
Answer:-Both the options
(17)gulp-concat helps with __________
Concatenation of files in given Location
Concatenation of css files
Concatenation of .js/.css files alone
Concatenation of JavaScript files
Answer:-Concatenation of files in given location
(18)Which command in the CLI will trigger the 'default` task?
run default gulp
run gulp default
gulp
All the options
run gulp
Answer:-gulp
(19)gulp.src in gulpfile.js refers to ______.
Source location of files to be acted upon
root folder of gulp
Source location of all files
location of gulpfile.js
Answer:-Source location of files to be acted upon
(20)The main objective of compressing (images / CSS / JavaScript) is to help with ____________.
All the options
Reduce LOC
None of the Options
Improving performance
Reduce Overhead
Answer:-All the options
(21)gulp.src in gulpfile.js refers to ______.
root folder of gulp
Source location of all files
Source location of files to be acted upon
location of gulpfile.js
Answer:-Source location of files to be acted upon
(22)Which helps with sequencing the tasks one bye one?
Only watch & plumber
.pipe
plumber
watch
All the options
Answer:-.pipe
(23)Which package helps in minifying the CSS?
gulp-minify-css
gulp-css-minify
gulp-min-css
gulp-compressify-css
Answer:-gulp-minify-css
(24)Which plugin helps in task dependencies?
No gulp plug-ins needed
gulp-order
gulp-seq
gulp-depend
Answer:-No gulp plug-ins needed
(25)Compression of images could be easily achieved using which gulp plug-in?
gulp-minjpg
gulp-minipng
gulp-minjpeg
gulp-imagemin
gulp-minijpeg
Answer:-gulp-imagemin
(26)Which task would be called in gulp, by default?
Watch
Jshint
Default
Plumber
(27)Organizing the gulp plug-ins can be easily achieved through
gulp-load-plugins
gulp-load-package
gulp-reload-package
gulp-reload-plugins
Answer:-gulp-load-plugins
(28)In-memory caching is enabled with the help of which gulp plug-in?
gulp-sess
gulp-cached
gulp-cookie
gulp-tempcache
Answer:-gulp-cached
(29)To convert .svg icons into fonts, gulp provides ________ plug-in.
gulp-iconfont
None of the Options
gulp-svgchange
gulp-svgfont
All the options
Answer:-gulp-iconfont
(30)How to check if gulp has been installed successfully?
gulp -check
gulp -v
gulp -verify
All the options
gulp -val
Answer:-gulp -v
(31)The default task / plug-ins in gulp are mentioned in this ______ file.
node_modules
app.js
node.js
gulpfile.js
index.html
node.js
Answer:-gulpfile.js
(32)How do you uninstall gulp?
Answer:-npm uninstall -g gulp
(33)What is gulp.task function and how to use it?
Answer:-The gulp.task is a function and used to define your tasks