Unix Quiz | Unix Multiple Choice Questions and Answers

(1) The command who sort - file1 > file2
[A] Results in an error
[B] Sorts the contents of file1 and puts it in file2
[C] Both (a) and (b)
[D] None of the above
Answer: None of the above
(2) Choose the correct statements.
[A] | can be used to direct output to programs
[B] > can be used to direct output to a named file
[C] The symbols > and | are both processed by shell
[D] All of above
Answer: All of above

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Article and Schedule Quiz Start Test!
(3) Which of the following are not filter programs?
[A] date
[B] sort
[C] catr
[D] grep
Answer: date
(4) The main reasons for the success of pipes are
[A] The availability of many filter programs
[B] UNIX treats devices as files
[C] It provides a 2-way communication channel
[D] Both (a) and (b)
Answer: Both (a) and (b)
(5) Which of the following file names can be found in more than one directoy?
[A] passwd
[B] bin
[C] date
[D] Both (a) and (b)
Answer: Both (a) and (b)
(6) If cat x. prints garbage. then x is probably a
[A] Binary file
[B] Text file
[C] Data file
[D] Source file
Answer: Binary file
(7) The file that stores an integer as a sequence of characters is a
[A] Text file
[B] Data file
[C] Binary file
[D] Core file
Answer: Text file
(8) The differences between malloc( ) and calloc() are:
[A] Malloc is used for dynamic allocation of memory, while cal:1�c can't be used for that purpose
[B] Malloc needs only one argument. while cal loc needs two.
[C] unlike malloc, calloc allocates memory and initializes it to 0.
[D] Both (b) and (c)
Answer: Both (b) and (c)
(9) Which of the following remarks about realloc are true?
[A] It allocates memory of required size that need not be contiguous
[B] It may shift the existing block
[C] It can work only with an existing block of memory
[D] Both (b) and (c)
Answer: Both (b) and (c)
(10) To allow only one user to work with a particular file at a particular time, one has to use
[A] Semaphore
[B] Critical region
[C] Locking
[D] Dedicated mode
Answer: Locking
(11) Files that store data in the same format as used in program are called
[A] Source file
[B] Core
[C] Text file
[D] binary files
Answer: binary files
(12) Choose the incorrect statements.
[A] Shell scripts are compiled
[B] Shell is a programming language
[C] Shell scripts are interpreted
[D] Shell scripts can accept arguments
Answer: Shell scripts are compiled
(13) Shell script is preferable to other forms of programming because it
[A] Occupies less space
[B] Enhances portability
[C] Makes programming task easier
[D] All of these
Answer: All of these
(14) Let x.c be a C source code. The command cc x.c > y
[A] is equivalent to the command cc x.c;mv a.out y
[B] is equivalent to the command cc -o y x.c
[C] serves no purpose
[D] None of the above
Answer: serves no purpose
(15) Which of the following string functions can be used to find the last occurrence of a given character in a given string?
[A] strchr
[B] strncpy
[C] strncmp
[D] None of the above
Answer: strchr
(16) Writing a C program that accepts input from keyboard, rather than from a file is advantageous because
[A] Keyboard is a file that is already open
[B] It can be used in a pipe, if it writes to stdout
[C] Both (a) and (b)
[D] None of the above
Answer: Both (a) and (b)
(17) If one doesn't want anyone else to read or write to a file named datfile, except through a program in a file filex , then he may use
[A] chmod u+s filex ; chmod go_rw datfile
[B] chmod 4711 filex ; chmod go_rw datfile
[C] chmod 4711 datfile ; chmod go_rw filex
[D] Both (a) and (b)
Answer: Both (a) and (b)
(18) The advantage of binary files over text files is that
[A] It can be accessed faster
[B] It is compact
[C] They are more reliable
[D] All of these
Answer: All of these
(19) The command echo welcome > /dev / tty
[A] Echoes welcome in all the terminals that are switched on.
[B] Echoes welcome in all the terminals that are logged on.
[C] Echoes welcome only in the terminal in which it is run.
[D] Both (a) and (c)
Answer: Both (a) and (c)
(20) Which of the following features of UNIX may be used for inter process communication?
[A] Semaphore
[B] Signals
[C] Pipes
[D] All of these
Answer: All of these

Take Mock Tests

Missiles Mock Test Start Test!
SSC MTS Mock Test Start Test
IBPS CLERK MOCK TEST Start Test
SSC MTS 2022 JULY 26 Shift 1 (ENGLISH) Start Test!
SSC GD Previous Year Paper 2021 Nov 17 Shift - I (Hindi) Start Test!
SSC CGL Tier - 1 PYP 2022 April 21 Shift- 1 (ENGLISH) Start Test!
MPSC PAPER I MOCK TEST 1 (ENGLISH) Start Test!
IB Security Assistant Mock test 1 (english) Start Test!
UP POLICE CONSTABLE MOCK TEST 1 Start Test!
DELHI POLICE CONSTABLE MOCK TEST 1 (HINDI) Start Test!