Follow Us On
follow us
paper of shell scripting embedded lab .

Exam section of megasasta.com

Paper of embedded lab in shell scripting

Course=shell scripting
Subject=embedded lab

Question no-1
How do you find out whats your shell?


Optional Answers

(a)                  echo $SHELL

(b)                  echo SHELL

(c)                  echo $shell

(d)                  echo shell

Sollution

(a)                  echo $SHELL

Question no-2
How do you find out the current directory youre in?


Optional Answers

(a)                  path

(b)                  dir

(c)                  pwd

(d)                  who

Sollution

(c)                  pwd

Question no-3
How do you search for a string inside a given file?


Optional Answers

(a)                  grep string filename

(b)                  ls -l | grep string > filename

(c)                  grep v string filename

(d)                  all of the above

Sollution

(a)                  grep string filename

Question no-4
How do you read keyboard input in shell scripts?


Optional Answers

(a)                  head {variable-name}

(b)                  read {variable-name}

(c)                  scanf {variable-name}

(d)                  none of the above

Sollution

(b)                  read {variable-name}

Question no-5
Which of the following command can be used to calculate square of a number?


Optional Answers

(a)                  sqr = `expr num /* num`

(b)                  sqr=`expr $num * $num`

(c)                  sqr=`expr $num /* $num`

(d)                  sqr=`expr $((num * num))`

Sollution

(c)                  sqr=`expr $num /* $num`

Question no-6
What will be the output of following command?
date | head c 8 | tail c 4


Optional Answers

(a)                  IST

(b)                  2015

(c)                  Apr

(d)                  Mon

Sollution

(c)                  Apr

Question no-7
Which command can be used to display the calendar of current month?


Optional Answers

(a)                  cal

(b)                  cal -m

(c)                  cal m 04 2015

(d)                  all of the above

Sollution

(d)                  all of the above

Question no-8
Given a file f.txt with permissions r-xr-xr-x . Which command is used to change the file permissions to rwxr-x-w- ?


Optional Answers

(a)                  chmod 555 f.txt

(b)                  chmod 762 f.txt

(c)                  chmod 564 f.txt

(d)                  chmod 752 f.txt

Sollution

(d)                  chmod 752 f.txt

Question no-9
Which of the following command can be used to display only the 5th line of a file file1.txt? Assume that file1.txt contains 10 lines.


Optional Answers

(a)                  cat file1.txt | head n 5 | tail n 1

(b)                  cat file1.txt | tail n 6 | head n 1

(c)                  both (a) and (b)

(d)                  none of the above.

Sollution

(c)                  both (a) and (b)

Question no-10
Which of the following condition is true and has correct syntax? Given a=10 and b=20.


Optional Answers

(a)                  if ( $a lt $b ) then { }

(b)                  if [ $a lt $b ] then fi

(c)                  if [$ a < $b ]; then do done

(d)                  if [$a lt $b ]; then fi

Sollution

(d)                  if [$a lt $b ]; then fi

Jai guru dev

We are giving free online platform/site so that indian people can give free advertisement to interchange their day to day goods online and product by post free advertisement or classified on mega sasta site by selling indian sasta saman online by this site. so that a wastage stuff of one indian person can be used by another indian person and both person can enjoy online or offline transaction free of cost by this site. buyer and seller both will be satisfy. Its a mega free advertisement online exchange for your day to day stuf without any mediator. You can give mega advertisement for indian car, bike, find coaching, furniture, buy sell books, table, mobile, plots, cloths, tv, laptops, vihicle, cell, phones, jeans, shirts, shoes, find jobs or antique. You can give free mega advertisement for anything on this site.

Creative Commons License
mega sasta by shubhali is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Permissions beyond the scope of this license may be available at http://megasasta.com/contactus.php.