Follow Us On
follow us
paper of Operating System Shell Programming ECA

Exam section of megasasta.com

Paper of Shell Programming in Operating System

Course=Operating System
Subject=Shell Programming

Question no-1
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-2
What will be the output of following command?
date | head c 8 | tail c 4


Optional Answers

(a)                  IST

(b)                  Apr

(c)                  2015

(d)                  Mon

Sollution

(b)                  Apr

Question no-3
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-4
Given a file f.txt. Which command is used to make it writeable and executable?


Optional Answers

(a)                  chmod 333 f.txt

(b)                  chmod +wx f.txt

(c)                  both a and b

(d)                  none of the above

Sollution

(c)                  both a and b

Question no-5
Which of the following commands 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 6 | tail n 1

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

(c)                  cat file1.txt | head -c 5 | tail -c 1

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

Sollution

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

Question no-6
Which command can be used to count number of lines in a file?


Optional Answers

(a)                  lc filename

(b)                  wc filename

(c)                  wc -l filename

(d)                  wc -n filename

Sollution

(c)                  wc -l filename

Question no-7
Which command can be used to display only current month (April)?


Optional Answers

(a)                  cal | head c 10

(b)                  cal m

(c)                  date | head c 10 | tail c 6

(d)                  date m

Sollution

(a)                  cal | head c 10

Question no-8
How does a case statement looks in shell scripts?


Optional Answers

(a)                  case $choice in do a) ;; b);; *) ;; done

(b)                  case $choice is a) ; b); *) ; esac;

(c)                  case $choice in a) ;; b);; *) ;; end

(d)                  case $choice in a) ;; b);; *) ;; esac

Sollution

(d)                  case $choice in a) ;; b);; *) ;; esac

Question no-9
Which of the following command can be used to calculate product of two numbers a and b?


Optional Answers

(a)                  p=`expr $a * $b`

(b)                  p=`expr $a /* $b`

(c)                  p=(( $a * $b ))

(d)                  p = $(( a * b ))

Sollution

(b)                  p=`expr $a /* $b`

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


Optional Answers

(a)                  pwd

(b)                  path

(c)                  dir

(d)                  who

Sollution

(a)                  pwd

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.