79
64.8k
Chapter:

60+ Unit 2 Solved MCQs

in Linux Programming

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Computer Applications (MCA) , Programming Languages .

Chapters

Chapter: Unit 2
1.

Which of the following commands is used to summarize the disk usage?

A. chkdsk
B. du
C. fdisk
D. disk
Answer» B. du
2.

Which of the following commands is used to copy directory structures in and out?

A. cp
B. cp-p
C. cpio
D. copy
Answer» C. cpio
3.

Which of the following commands is used to change the working directory?

A. cd
B. chdir
C. changedir
D. cdir
Answer» A. cd
4.

Which of the following commands is used to count the total number of line, words and characters contained in a file?

A. count p
B. wcount
C. wc
D. countw
Answer» C. wc
5.

Which of the following commands is used to list contents of directories?

A. 1s
B. dir
C. 1p
D. tar
Answer» A. 1s
6.

Which of the following commands is used to list remove files?

A. erase
B. rm
C. delete
D. dm
Answer» B. rm
7.

Which of the following commands is used to count just the number of lines contained in a file?

A. wc – 1
B. wc - w
C. wc - c
D. wc - r
Answer» A. wc – 1
8.

Which of the following directories contain all the files created by a user, including his login directory?

A. /tmp
B. /usr
C. /etc
D. /dev
Answer» B. /usr
9.

Which command is used to copy the three files wb, collect and mon into the misc directory, under the same, when you were currently in the programs directory?

A. copywb collect mon /mis
B. cpwb collect mon ../misc
C. copywb ../misccollect ../mismon ../misc
D. tarwb collect mon /misc
Answer» B. cpwb collect mon ../misc
10.

Which command is used to assign only read permission to all three categories of the file ‘note’?

A. chmod a-rw
B. chmodgo+r note
C. chmodugo = r = note
D. chmodu+r, g+r, o-x note
Answer» C. chmodugo = r = note
11.

Which command is used to make all files and sub-directories in the directory (prog) executable by all users?

A. chmod –R a+xprogs
B. chmod –x a+xprogs
C. chmod -1 a+xprogs
D. chmod –R 222 progs
Answer» A. chmod –R a+xprogs
12.

The chmodugo+rw note command can be represented in octal notation as

A. chmod 555 note
B. chmod 666 note
C. chmod 333 note
D. chmod 444 note
Answer» B. chmod 666 note
13.

Which of the following commands is used to view the file 24 lines at a time?

A. pg
B. 1p
C. cat
D. /p
Answer» A. pg
14.

The second set of the three permissions (r-) indicates that

A. group has read permission only
B. other has read permission only
C. group has write permission only
D. owner has read permission only
Answer» A. group has read permission only
15.

The dmesg command

A. Shows user login logoff attempts
B. Shows the syslog file for info messages
C. Kernel log messages
D. Shows the daemon log messages
Answer» C. Kernel log messages
16.

The command “mknodmyfifo b 4 16”

A. Will create a block device if user is root
B. Will create a block device for all users
C. Will create a FIFO if user is not root
D. None of the above
Answer» A. Will create a block device if user is root
17.

Which command is used to set terminal IO characteristic?

A. tty
B. ctty
C. ptty
D. stty
Answer» D. stty
18.

Which command is used to record a user login session in a file ?

A. macro
B. read
C. script
D. none of the above
Answer» C. script
19.

Which command is used to display the operating system name ?

A. os
B. Unix
C. kernel
D. uname
Answer» D. uname
20.

Which command is used to display the unix version ?

A. uname -r
B. uname -n
C. uname -t
D. kernel
Answer» A. uname -r
21.

Which command is used to print a file ?

A. print
B. ptr
C. lpr
D. none of the above
Answer» C. lpr
22.

Using which command you find resource limits to the session?

A. rlimit
B. ulimit
C. setrlimit
D. getrlimit
Answer» B. ulimit
23.

Which option of ls command used to view file inode number ?

A. –l
B. -o
C. –a
D. –i
Answer» D. –i
24.

Find / -name ‘*’ will

A. List all files and directories recursively starting from /
B. List a file named * in /
C. List all files in / directory
D. List all files and directories in / directory
Answer» A. List all files and directories recursively starting from /
25.

In which directory can you store system user default files used for creating user directories?

A. /usr/tmp
B. /etc/default
C. /etc/skel
D. /etc/users
Answer» C. /etc/skel
26.

What command do you use to create Linux file systems?

A. fdisk
B. mkfs
C. fsck
D. mount
Answer» B. mkfs
27.

What command is used to display the characteristics of a process?

A. au
B. ps
C. du
D. pid
Answer» B. ps
28.

What command is used to list the files chap0l, chap02 and chap04?

A. ls chap*
B. ls chap[124]
C. ls - x chap0[124]
D. ls chap0[124]
Answer» C. ls - x chap0[124]
29.

What command is used to add printing jobs to the queue?

A. lpd
B. lpr
C. lpq
D. lpc
Answer» B. lpr
30.

What command is used to list contents of directories?

A. tar
B. dir
C. lp
D. ls
Answer» D. ls
31.

Command used to determine the path of an executable file is

A. which
B. where
C. wexec
D. what
Answer» A. which
32.

Command used to count number of character in a file is

A. grep
B. wc
C. count
D. cut
Answer» B. wc
33.

Which of these commands could you use to show one page of output at a time?

A. less
B. sed
C. pause
D. grep
Answer» A. less
34.

Which commands will give you information about how much disk space each file in the current directory uses?

A. ls -l
B. ls -la
C. du
D. ls -a
Answer» C. du
35.

Which of the following command output contains userid?

A. ls
B. help
C. date
D. ls –l
Answer» D. ls –l
36.

Which command is used to display all the files including hidden files in your current and its subdirectories ?

A. ls –aR
B. ls –a
C. ls –R
D. ls –l
Answer» A. ls –aR
37.

Which of the following commands can be used to copy files across systems?

A. ssh
B. telnet
C. rsh
D. ftp
Answer» D. ftp
38.

pwd command displays

A. user password
B. password file content
C. present working directory
D. none of the mentioned
Answer» C. present working directory
39.

Which of the following commands can be used to change default permissions for files and directories at the time of creation

A. Chmod
B. Chown
C. Umask
D. Chgrp
Answer» C. Umask
40.

Which tar command option is used to list the files in a tape archive format?

A. cvf
B. tvf
C. xvf
D. ovf
Answer» B. tvf
41.

Which of the following commands will allow the user to search contents of a file for a particular pattern

A. touch
B. grep
C. find
D. ls
Answer» B. grep
42.

Write the command to display the current date in the form dd/mm/yyyy.

A. date +%d/%m/%Y
B. date +”%d/%m/%Y”
C. date +/%d/%m/20%y
D. date +”/%d/%m/20%y”
Answer» A. date +%d/%m/%Y
43.

Which one shows the name of the operating system?

A. uname -n
B. uname -r
C. uname -o
D. uname –m
Answer» C. uname -o
44.

How do you add (append) a file “file1” to the example.tar file

A. no you cannot add a file to example.tar
B. tar -cvf example.tar file1
C. tar -rvf file1 example.tar
D. tar -evf file1 example.tar
Answer» C. tar -rvf file1 example.tar
45.

How to execute ls command inside a vi editor?

A. !ls
B. :ls
C. :!ls
D. we can’t execute
Answer» C. :!ls
46.

Which command gives the first byte where the difference is in the file1 & file2?

A. diff
B. cmp
C. comm
D. ls -a
Answer» B. cmp
47.

To open a file file1 with cursor at line number 4

A. vi +num file1
B. vi +set num file1
C. vi + “set num” file1
D. vi +/se nu file1
Answer» A. vi +num file1
48.

sed is a command typically used for

A. Perform complex calculations
B. Perform FIFO based non-blocking I/O
C. Modify/print selective contents of a file
D. None of the mentioned
Answer» C. Modify/print selective contents of a file
49.

What communication command provides communication to another user logged on by writing to the bottom of their terminal?

A. talk
B. write
C. chat
D. transmit
Answer» A. talk
50.

Which screen manipulation command sets the screen back to normal?

A. tput cup
B. tput smso
C. tput rmso
D. tput blink
Answer» C. tput rmso

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.