Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
173 views
33 pages
Unix MCQs PDF
Uploaded by
Amir Shahzad
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Unix-MCQs-PDF.pdf For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
173 views
33 pages
Unix MCQs PDF
Uploaded by
Amir Shahzad
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Unix-MCQs-PDF.pdf For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Unix-MCQs-PDF.pdf For Later
You are on page 1
/ 33
Search
Fullscreen
Chapter 2 lL 2. - “1, UNIX UNIX was developed by (a) Bell Labs (b) Berkley Software Group (c) California University (d) American Defence Academy Chocolate Chip is (a) a latest Intel product (b) another name for BSD 4.2 Version {c) another name for System V (4) another name for System III Which of the following features of UNIX may be used for inter process communication? (a) Signals (b) Pipes {c) Semaphore (d) Message Queues . Pick the incorrect statements. (a) Shell is a command interpreter. (b) Shell is the interface between user and kernel. (c) System can't work without a shell (d) Shell is a program. . UNIX is (a) 2 multi-user system (b) a real-time system (c) @ multi-task system (d) name of a file in the root directory . Which of the following statements best explains a process? (a) Itis a program, (b) It is a program in execution. (e) Itis an instance of a program in execution (d) It is a program that uses system calls. In & system, if 5 people are currently using the vi editor, then the number of corresponding processes will be (al tb) 5 fc) 2 id) O44 %, "10. 12, “13. 14, 415, MCQs in Computer Science Kemel is not involved (a) when a read operation is done (b) when a pressed key is echoed on to the screen (c) in resource allocation (d) none of the above ‘The command echo wele y (a) echoes welcome in all the terminals that are (b) echoes welcome in all the ter (c) echoes welcome only in the terminal in which it is run, (d) signals the error message - Terminal number not specified. rai > fa dev/null fa) isa file (b) has write permission for all (c) is the UNIX built-in dustbin (d) none of the above The advantage of binary files over text files is that @) (b) it can be accessed faster (c) many commands (like cat) assume the named file to be a binary file. (d) they are more reliable The permission bits of a file noname, ean be setto _rws_ _x_ _x by the command. (a) chmod 711 noname (b) chmod go-rw noname (c) chmod 2711 noname (d) none of the above bin/passwd has the user execution permission set to ‘ss’ because (a) it is not executable (b) it should allow users who don’t have write permission to /etc/passwd to write to it (c) etc/passwd is write protected (d) this facility assigns to the user, permissions of the program owner, temporarily. If one doesn’t want anyone else to read or write to a file named dat £ile, except through a program in file £ilex, then he may use (a) chmod u+s filex ; chmod go-rw datfile (b) ¢ {c) oh @d) & Writing a C program that accepts input from keyboard, rather than from a file is advanta- geous because (a) keyboard is a file that is already open (b) it facilitates batch processing (e) it-can be used ina pipe, if it writes to stdout (d) none of the above od u+s datfile ; chmod ga-rw filex 4711 darfile ; chmod go-rw filex 4711 filex ; chmod go-rw datfile#17, “18. 19, 20, “21, 22. 23. 44. UMX 45 . Consider the following command that invokes the executable file a.our, with the following command line arguments a.out God loves you argy[1][2] corresponds to the character (aye who (eh. wa In the previous question after the operation argv++, the value of argv [1][2] will be fae (b) a ()v (4) undefined Which of the following string functions can be used to find the last occurrence of a given character in a given string? (a) strnemp (b) strncpy (c) strchr (d) None of the above Choose the correct statements (a) The function stat refers a file by its name. (b) The fanetion stat refers a file by its file descriptor. (c) The function fstat refers a file by its file descriptor. (d) The function fetat refers a file by its name. Which of the following fields in the structure stat, has information about the permission setting of a file? (a) st_gid (b) st_mode (c) st_ino (a) st_uid To simulate the command “system*, which of the system calls - fork, wait, and excel is/are to be used? (a) fork and wait (b) all three (c) fork and excel (d) wait and excel Consider the program main() { printf ("He arose a victor from\n"); system (*“date*); printf ("the dark domain"); } If a.out is the executable code corresponding to the above source code, then the command aout > outé (a) redirects the output of date to file out £ (b) displays the output of date on the screen (¢) prints everything on the screen (4) prints the two messages on the screen ‘The default permission bits of a file when it is created for the first time, is contralled by {a) chmod value (by) mask walue (c) umask value’ (d) none of the above Let x.c be a C source code. The command ce x.c > y (3) is equivalent to the command cc x.c ; mv aout y (b) is equivalent to the command ec -o y x.25. 27. 28. 29. “31. . If path is set to. :/u MCQs in Computer Science (c) serves no purpose (d) none of the above Which of the following sections in the manual covers system calls? (a) 1 (b) 2 te) 3 (a) 4 . Which of the following are not system calls? (a) chmod (b) open cme Choose the correct statements. (d) gete (a) C programs can directly make system calls. (b) System calls are functions used by the shell (c) Library functions use system calls. (d) Library functions don't use system calls Which of the following remarks about system calls, library functions and UNIX ebmmands are true? (a) System call is a part of kernel, while the other two are not a part of kemel (b) Unlike library functions, system calls and Unix commands are stand-alone programs (c} Library fiunctions and UNIX commands use system calls (4) Unlike system calls, library functions and UNIX commands are stand-alone programs The 2 in the manual entry access (2) (a) implies access is a system call (b) implies access is a library function {c) refers to the seetion number (d) none of the above sx/bin, then (a) the command one types will be first checked in the current directory, then /usr /x and fusr/bin. (b) if a command is found in both /use/x and /usr/bin, then the one in /usr/x will be executed. {c) in the previous choice, what happens is unpredictable. (d) if a command is found in both /usr/x and /usr/bin, then the one in /usr/bin will be executed. A file is created with the following contents echo today is: date If you type +, then fa) it echoes the message, followed by date (b) it gives the desired output only if the execute permission of file x is set. (©) the desired output can be got by the command sh x, whieh works even if x has its execute permission not set. (d) none of the above. ix2 33. 34. 35. 36. 37. 38. 39. “40. 4. a2. UNIX 47 ‘Shell script is preferable to other forms of programming because it (a) executes faster (b) enhances portability {c) occupies less space (d) makes programming task easier Choose the incorrect statements. (a) Shell scripts can accept arguments (b) Shell scripts are interpreted {c} Shell is a programming language (d) Shell scripts are compiled Files that store data in the same format as used in program are called (a) binary files «b) source file (c) text file (a) core To allow only one user to work with a particular file at @ particular time, one has to use (a) semaphore (b) critical region (ec) locking {d) dedicated mode ‘Which of the following remarks about realloc are true? {a) It allocates memory of required size that need not be contiguous (b) It never shifts the existing block {c} It can work only with an existing block of memory (4) It may shift the existing block The differences between malloci) and calloc() are: (8) malloc is used for dynamic allocation of memory, while calloc 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) malloc needs two arguments and calloc only one. ‘The file that stores an integer as a sequence of characters is a {a} text file tb) data file (©) binary file (d) core Ifcat x, prints garbage, then x is probably a (a) data file {b) binary file (c) text file (4) souree file Which of the following file names can be found in more than one directory? (a) pasewd (b) bin (e) dae (d) none of the above bin a bucket for storing information (b) has files in binary code a directory (d) none of the above The main reasons for the success of pipes are (a) the availability of many filter programs (b) UNIX treats devices as files (6) it provides a 2-way communi (d) all of the above tion channel . Which of the following are not filter programs? (a) date (b) sort (©) cat (d) grepMCQs in Computer Science 44, Redirection in pipes can be achieved by using #46. +47. 49. “51. 52. “53. (a) = {b) >> (ce) tee (d) lpr . Choose the correct statements. (a) The symbols > and { are both processed by shel! (b) = can be used to direct output to 2 named file (ce) | can be used to direct output to programs (d) Filter programs cun be piped The command who | sort - filel> filez (a) results in an error (b) sorts the contents of fi lel and puts it in £ile2 {c) puts in £i1e2, the sorted output of who, followed by sorted contents of fi lel (d) none of the above If the command cat x, is executed after successfully executing the command time sort filename > x, then (a) only the time details will be displayed {b) only the sorted contents of the file £i lename will be displayed (ce) an error message will be displayed (d) the sorted contents of the file filename, along with the time information will be displayed Which of the following information is not present in an i-node? (a) Contents of the file (b) Size of the file (ch) Name of the file (d) Permission setting of the file ‘The system identifies a file by its (a) name (b) absolute path (c) file owner () inode number The system identifies the end of a file by the (a) BOP character (b) file size ic) i-node number — (d) none of the above The command line argument a.cut x ‘a bt tc d" (a) is acceptable (b) is acceptable if the double quotes are replaced by single quotes (c) is acceptable if the single quotes are replaced by double quotes 4d) none of the above Which of the following metacharacters will be recognized by the shell, even if it comes within double quotes? (a) § (b) * () ? (d) None of these Lint should be used (a) before compilation . (b} after compilation (ch to analyze a C code {d) none of the aboveUNIX 49 $4, Environment variables can be accessed by (a) system programs (b) C programs (©) shell scripts (d} none of the above 55. Which of the following are character special files? (a) Terminal (b} Printer (c) Modem (d) Tape Drive $6. If one exports a variable (a) variables placed in the environment by a child process are not inherited by the parent process. (b) it is passed to all its descendant processes {¢) itdies when the shell that created it dies (d) only the first two choices are correct 57. Profilers are (a) tools that analyze the run time behaviour of a program (b) tools that check a C code for cross file consistency (c) tools that keep track of evolving versions of a file (d) none of the above 58. The shell command : (a) does nothing (b) can be used to cause infinite looping (c) can take arguments but it cannot act on them {d) can be used to indicate a comment 859, Which of the following tools can be used to keep track of evolving versions of a f fa) make (b) yace (c) secs (@) av *60, The . (dot) shell command fa) can take command line argument {b) will fork a child shell to execute the named shell script (c) can be used to change the environment of the current shel! (d) all of the above 761. mt (a) is a macro processor (b) can be used to preprocess C code (c) can be used to preprocess assembly language program {d) mone of the above *62. The first thing that is searched when a command references a file is its fa) i-node (b) i-node number {c) permission setting (d) none of the above50 MCQs in Computer Science 63. co command sequentially invokes. (a) preprocessor, compiler and link editor (b) compiler and link editor (e) preprocessor, compiler, assembler and link editor (d) compiler, assembler and link editor *64, Among the directory entries, i-node and the file contents, which will be changed when a file is updated? (a) Only directory entry and file contents —_(b) Only i-node and file contents (©) All the three (d) None of the above 68. The cc command (a) can take more than one argument (b) can act on files with .¢ or .o extension (6) creates .o files by default when more than one argument with .c extension is present (d) if provided with more than one argument, immediately terminates if the first argument fails to compile successfully "66, The my command changes (a) only the directory entry (b) only the directory entry and ienode (©) only the i-node number (d) none of the above 67. If 7 terminals are currently logged on, then the command date ; who | we -1, displays {a) date followed by 7 (b) date followed by 8 (c) date followed by 1 (d) an error message *68. Choose the correct answers if the command ls -1 /dev/mt0 displays root 3, 0 jan 16 11:05 mto a special file a tape drive (c) mt0 indicates that it is a mounted tape (d) The ‘* indicates that data transfer is done in blocks 69. Choose the correct statements. (a) 1d x. is a valid command (assume x. 0 exists) (b) 14 x.0 issameasce x.0 (c) cc x. isa valid command (assume x. exists) (d) All of the above & /dev/tty (a) throws garbage onto the terminal tty 70. (b) just echoes what you type, line by line (c) terminates if one types control a, at the beginning of a line (d) terminates if one types control 4, anywhere in a lineUNIX 51 71. The header files used in C programs are usually found in (a) /bin/include (by in/inelude (©) /dev/include (d) Jusr/include 72. The command pwa displays /x/y. After executing the command chmod u-x, which of the following commands will not work? (a) cd .. (b) Is (c) chmod urx (d) pwd 73, A C program should be compiled with -¢ option (like c¢ -@ xx. EC) to use (a) prof (b) make (c} lprof (d) sab 74. The difference between a pipe and a regular file is that (a) unlike a regular file, pipe is not a file. (b) the dats in a pipe is transient, unlike the contents of a regular file. (©) pipes forbid random accessing, while regular files do allow this. (d) all of the above. 75. Choose the correct statements. (a) The default linking arrangement for cc is dynamic. (6) Dynamically linked programs save disk storage (c) Dynamically linked programs enhances shareability of library routines. (d) Dynamically linked programs can be fixed or enhanced without relinking the applications that depend on it. 16. Context switch changes the process mode from (a) user to kernel mode (b) kernel to user mode (ce) kernel mode to the kernel process: (d) kemel process to the kernel mode of some process 77. File x. has § lines of code. The command date i tee abe | sort - x.c | we -1, displays (a) 5 (b) 6 te) 0 (d) an error message 78. Which of the following comments about the signals system call are true? (a) It takes up two arguments {b) The second argument, is a function call (¢) The second argument is a pointer to a function (d) The first argument is an integer 79, Lint can analyze the named source code for (a) inconsistent usage (b) non portability (©) suspicious constructs (d) none of the above 80, Which of the following characteristics of the original process are preserved when, the exec system call is executed? (a) The current working directory (b) The open files (c) PID (d) PPID52 “81. 82. “84. 86. 87. MCQs in Computer Science Which of the following remarks about lex are true’? (a) It generates a C program. (b) It produces a C code that consumes more memory than a C program that can be written. separately to accomplish the same task. (c} It produces a C code that executes slower than a C program that can be written separately to-accomplish the same task. (d) None of the above. Which of the following programs are not imeractive? (a) passwd (b) date (©) grep (a) sh . Lex ean be used for {a) text processing (b) code enciphering {c) compiler construction (d) collecting statistical data of different patterns The number of errors in the following shell script echo How are you ? read $answer is fa) 0 (b) 2 (©) 2 @3 The read in the previous question is a {a) library function (b) system call (c) shell command (d) none of the above If lex.1 isa Lex code then (a) the command lex lex.1 invokes lex to act on lex. 1 (b) the command lex Lex. 1 writes its output to the file Lex.yy.c (c) lex.yy.c has the definition of the function yylex (d) Lex library can be invoked by the compiler option 11 Choose the correct statements. (a) Any process has an associated owner ID and group ID. (b} Effective ID defines who you are for the duration of a process, (c) Real ID defines who you are for the duration of a process. (d) Effective ID is available in /etc/pasewd file. A file hai has the following shel! script in it echo Oh! What a wonderful day echo Day I will never forget 1>&2 echo Day I will never ever get The command sh hai > mn (a) puts all the three messages in mn (b) puts the second message both in mn and the screen#39, *90, a1. 92. 93. 95. 96. UNIX 33 (c} puts only the first and the third message in mn (d) results in an error No shell script can take input from (a) stdin (b} the output of the previously executed command redirected ta ii (c) the file that holds the seript (d} none of the above The command co x.c && a.out (a) is equivalent ce xc (b) means execute: a.out only when x. © compiles successfully (c) means execute a. out only if (d) all of the above: Which of the following shell seript’s looping features daes nat recognize the break cam- mand? (a) while (b) until fc) tor (d) None of the above Shell script (a) needs no compilation (b) is ideal for manipulating a file, character by character (c) is not good in arithmetic operations (d) enhances portability ‘The desirable features of a new shell script you write is that (a) it should take its input from stdin (b) on successful termination, it should exit with a non-zero value (e) it should not accept command line arguments (@) it does some cleaning up operation, on termination Which of the following shell commands displays the contents of each of the command line arguments, one by ane? (a) cat s* {b) cat ‘5"" () cat “se" 9 @) cat * The disadvantage of a pipe is that (a) it is aone way communication channel (b) it dies along with the process that created it (c) it can’t be shared by unrelated processes (d) none of the above The state of signals. are (a) preserved across a fork call (b) not preserved across a £ {c) not preserved across an exec call (d) preserved across an exec call x.¢ retums a value 0 (o the system, call7, #100. 101. “102, 103. 104, #105, *106, MCQs in Computer Science A fork system call will fail, if (a) the previously executed statement is also a fork call. (b) the limit on the maximum number of processes in the system would be exceeded. (c) the limit on the maximum number of processes that can be under execution by a single user would be exceeded. (d) all of the above. Which of the following options for the shell command test should be followed by the file descriptor? (a) © tb) & () t (d) s Which of the following displays the exit status of the last executed command? (a) echo $f (by echo $$ (ce) echo $? (da) echo $! Which of the following file names cannot be displayed if 1 * is run? (a) -xy (b) 2x () ox (d) hidden Which of the following initiates the sequence of events that ultimately allows a user to login? (a) clri (b) sync {) login @) i gete (stdin) {a) results im run time error (b) results in syntax error (©) is equivalent to getchar() ; {d) none of the above Which of the following is not the work of a C-preprocessor? (a) Macro expansion (>) File inclusion (c) Conditional compilation (d) None of the above Which of the following is used to write disk block images from memory to disk? (a) clr (b) sync () mkfs (d) stry Choose the correct statement, (a) To read successive characters from an open file, qetchar and scanf can be used interchangeably. (b) Ta read successive characters from an open file, getchar and read can be used interchangeably. (c) The vead system call reads from the buffer. {d) None of the above. ‘The following program main () { close (1); print (“How RU?" } (a) is syntactically incorrect (b) results in’ a run-time error (c) will wait indefinitely, if executed {d) none of the above107, 108, 109. 110, 112. 113. 114, 115, *116. *117. 119. UNIX 58 The PID of the kernel process is (a) undefined (b) 0 (} 1 (@) 3 Choose the correct remarks. (a) exit and return can be used interchangeably (b) Use of return terminates the program (c) Use of exit terminates the program (d) exit retums a value to the system Which of the following is an index to the array of open files maintained by the kernel for a user? (a) inode (b) i-node number {c) File deseriptor (4) File pointer In which of the following directories does init reside? (a) root (b) bin (c) ete (d) usr The command cat > x (a) is invalid (b) creates a file x and displays an error message (©) creates a file x and waits for the user to give input from the keyboard (d) none of the above Which of the following are defined in stdio.h? {a) EOF (b) NULL (c) BUFSIZE —_{d) None of the above The Login prompt can be changed by changing the contents of the file (a) inittab (b) init (c) pasewd (é) gettydefs ‘When the read system call encounters EOF, it returns (a) some positive integer (b) some negative integer ()} 9 (@ -2 Which of the following library functions do not return a pointer to the structure FILE? {a} fopen (b) Eclose (c) Exeopen (@ fwrite Which of the following processes are involved in the process of allowing a person to login? (a) init (b) getry (c) login (d) kernel Which of the following system calls reads 8 bits from the standard input? (assume buf £ is a pointer to the buffer area) (a) read(o, buff, 8) (b) read(l, buff, 8) (ch vead(o, buff, 1) (d) read(1, buff, 1) Which of the following are implemented as macros (rather than functions)? (a) getchar (b) getc (co) Egete (d) fpute Choose the correct statements, (a) errno is an external variable available to any ‘C* program (b) errno is set to a value when an error occurs {c) errno is cleared when a nonerroneous call is made {d) errno cannot be used to find the cause of an error56 120. 121. 122, 123, 128, 126. 127. 128. #129, 130, MCQs in Computer Science When the user responds to Login prompt {a) getty forks Login process (b) Login process replaces get ty process (c) a shell will be created (¢) none of the above ‘The shell command cat x y > x (a) doesn’t work (b) replaces the contents of file x, by the contents of file yy (c) does nothing, other than displaying an error message (d) none of the above Which of the following return file descriptor? {a) close () fopen (©) open (@) creat To simulate the who command, one has to access the file (a) /etc/passwd (b) /bin/.login (e) /etc/utmp (@) fusr/fuser_da . A file system in UNIX has the four sections—boot block, super block, I-list and data block that are arranged in the order (a) boot block, super block, I-list and data block (b) boot block, dats block, super block and T-list (c) boot block, data block, I-list and super block (d) super block, boot block, data block and I-list stderr, stdout, stdin have the file descriptors (a) 0, 1, 2 respectively (b) 0, 2, I respectively (©) 1,0, 2 respectively (d) 2, 1, O respectively Which of the following functions can be used to randomly access a file? fa) igete {b) getc (c) fseek (d) ftell A manual entry of the form xyz (3S) (a) implies xyz is a system call (b) implies xy¢ is a library funetion (e) means xyz is a library function that is part of the standard i /o package (d) means xyz is a library function that is a part of the standard math library ‘The reference time adopted by UNIX is € fa) Jan 1, 1970 {b) Jan 1, 1980 ic) Jan 1, 1982 (d) Jan 1, 1972 perror() can be simulated by using (a) errno and sys_nerr (b) sys_errlist and sys_nerr (c) sys_errlist and errno (a) none of the above A process that uses CPU, cannot continue to use it if (a) the CPU time slice expires (b) a higher priority process arrives (c) it has to wait for an event to happen (d) it executes an exit statementi. 132. #133. 134. 135, 136. 137. #138, UNIX 7 The command cd. /.. / (a) serves no purpose (b) is invalid (c) is equivalent toca. . (d) none of the above The UNIX tool awie (a) can do both numerical and string comparison (>) decides from the context whether the comparison is numerical or alphabetical (e) signals an error if an alphabet is compared with a number (d) all of the above Which of the following strings will be matched by aw, if / (x +) *y!$/ is the specified pattern to be searched for? (a) x +x +x ty!S (b) x x x x yIS () x x x xy! (d) none of the above When awk encounters strings in arithmetic expressions, (a) it treats them as having the value 0 (b) it treats them as having the value 1 (c) it displays an error message (d) it is assigned an arbitrary value Which of the following comments about awk are true? (a) It is a text processing language (b) Arrays can be indexed by string (c) It has features for redirecting its output (4) None of the above Which of the following UNIX tools, receives input only from the standard input? (a) awk (b) grep {c) sed (d) tr If =. isa file, then ed x. c creates a copy of x. in fa) /etc (b) fuer (c) /tmp @) fusr/bin The number of 3's in the output of the following C program maint) printe("l"); fork(); printé(*2*); fork(); fork(); printi(*3*); is @) 1 tb) 8 (4 dd) 2 Which of the following processes has the PID 1? (a) kermel (b) unix (c) init (d) shell Which of the following remarks about fgrep are tue? (a) It is faster than grep. (b) It is compact to use. {c) It does not recognize any meta-character, (d) It can simultaneously search for different patterns.MCQs in Computer Science “141. Which of the following results in an error? (a) expr 445 (b) expr 9-3 () expr 230 (d) expr 7/5 142, Which of the following is not a command delimiter? (a) new line (b) ; fc) & (dy 143. A file abe has the following shell script in it. eat $1 > $1.s$ The command sh abe filel (a) results in an error (b) is equivalentto cp $1 $1.$3 (c) copies the contents of £ile1 to another file that has the PID of the executing shell as its extension (d) none of the above 144. *>* will be the output of {a) echo *2* (b} echo ‘*?*" (ce) echo "*7*" @d) echo \S\7\" 145. Which of the following shell variables can be used to customize the editors (like ex, vi)? (a) PATH (b) IFS (c) HOME (d) EXINIT Go through the following sequence of commands and answer the next two questions based on it. Secho $x $sh $xshai Sexport x Ssh *146. echo $x will output (a) hat () garbage (c) an empty line (d) none of the above *147. If the command exit is run twice followed by running the command echo §x, the output will be (a) hai (b) garbage (c) an empty line (d) none of the above #148. An orphan process (a) is a child process that was terminated before the parent process (b) is adopted by the login shell (c) is adopted by the process dispatcher (d) will be denoted by the process status O *149, Which of the following calls never returns an error? (a) getpia {by fork +(e) feet] (a) openUNIX 59 *150, The following C program maint) { forki); forkt}; printé(*yes") } prints yes (a) only once (b) twice fc) 4 times ({d) 8 times “151, When a process makes a system call, its mode changes from (a) user to kernel {b) kemel to user (c) restricted to unrestricted (d) unrestricted to restricted *152. Choose the correct statements. (a} When a process makes a system call, a context switch is initiated (b) Kernel is not involved in servicing a system call. (c) When a process making a system call has to wait for an event to occur, then a process switch to the kernel process is i (a) System calls cannot be serviced in keel mode. *183, The command 1s > xy (a) displays an error message, if xy exists and is write protected (b) if followed by cat xy, lists xy also (c) redirects errors, if any, to xy (d} none of the above 154, Shell functions (a) are another name for shell procedures (b) exceute faster than shell procedures (c) are executed by a new shell (d) are not executed by a new shell #188. The cc command makes a total of (a) 1 pass (b) 2 passes (c) 4 passes (d) 5 passes 156. Which of the following is not invoked when the cc command executes? (a) /libsepp (b) /lib/el (c) sbinsas @) /pinsid 157, creat will fail, if (a) there are too many open files (b) the filename is a directory (c) the named file already exists with its write permission off (d) the parent directory of the named file is write protected 158, Which of the following arguments to the open system call, will be discarded, file already exists? (a) OLTRUNG (b) O_LAPPEND (c) OLEXCL (d) O_CREAT the named159, 160. *161, 162. 167, 168. 169. 170, 171, MCQs in Computer Science Under which of the following circumstances rm /y / x, cannot remove x? (a) If x is write protected, but y is not write protected. (o) If x is not write protected, but y is write protected. (c) If y has its execution permission bit off. (d) All of the above. File pointer {a) is a Long integer (b) is of pointer data type (e) represents the position of the read-write head from the beginning of the file. (d) none of the above ‘The C compiler can be modified to compile programs coded in other high level languages just by changing (@) lib/ccom (b) /Lib/c2 (©) /libsel @) /bin/as When a file is aliased {a) a new directory entry is created (b) a new i-node is created (c) the i-node number is shared (d) none of the above . Setting the execute bit on has no meaning, if the file is a (a) directory (b) shell script {c) C source cade (d) symbol table Which of the following sections of an executable binary file has all uninitialised data items? (a) bss (b) Data {c) Header (d) Symbol table . In which section of a process, the information about the arguments to the program are available? (a) Data (b) Text (c} Stack (a) User-block . Which of the following system calls transforms an executable binary file into a process? (a) fork tb) exec (ce) ieee (d) Longimp UNIX was first installed in (a) IBM-360 (b) PDP/I1 (c) PDP/T (d) CRAY PID is used by the system to identify (a) a process (b) the file name {c) the i-node (d) all of the above Choose the best answer, Suspended processes are written onto a (a) swap area (b) dedicated area (cy) ROM (d) critical area Which of the following system calls, does not return control to the calling point, on termina- tion? (a) fork (b) exec fe) ioctl (@) longimp Which of the following remarks about the retura value of “wait” are true? (a) In case of normal termination (through exit), the lower byte of the wait status is set to zeroes172, #173, +174. *175, 176. UNIX 61 (b) In case of abnormal termination, the lower byte of the wait status is set to zeroes (c} A core dump sets the seventh bit on (d) A process in zombie status sets the seventh bit on The following C program main () 1 printf (*WHATIZIT"); system{“*date"); (a) first prints WHATIZIT and then displays the output of date command in the next line. (b) first prims WHATT2I” and then displays the eurput of line, (c) first displays the output of date command and then wHa’ (d) none of the above, The program main() 1 late command in the same IT in the next Line. printe ("x"); £flush{stdout) ; system("date”); (a) gives the same output as the program main() { até(*xin"); system("date*); (b) prints x, before displaying date (c) prints x after displaying date (d) all of the above An attempt to read from a locked file, results in (a) prematured termination (b) a deadlock (c) an indefinite wait (d) none of the above Which of the following is not a valid argument to the function main in a C program? (a) errne (b) arge (©) envp (d) argv ‘Mounting a file system results in the loading of (a) boot block (b) super block (c) i-node table (d) all of these62 MCQs in Computer Sclence *177, Choose the correct statements. (a) If two users execute a file, two copies will be there in memory (b) Shareable programs are loaded into swap area (c) chmod u+t filename, is a valid command (d) None of the above *178, Go through the following C program maint) { int i, nj; for(i = 1; i <= mj +i) fork(); printf ("yes” } For what value of n, will yes be printed 24 times? (a) 3 (b) 4 8 (4) Impossible to find such ann 179, Consider the following program main (} { printf ("Ged leoks at the heart, not the hand\n"); system("date"}; printé(*The giver, not the gift"); } If a.out is the executable file corresponding to the above program, then the command aout > x ; cat x {a) displays both the messages, with the output of date coming in between (b) displays the output of date before both the messages (c) does not display the first message (d) none of the above *180, The following program main() { if(fork() > 0) sleep (100); } results in the creation of (a) an orphan process (b) a zombie process (c) @ process that executes for ever {d) none of the aboveUNIX 63 181. In UNIX, the status of a process may be (a) running (b) orphan (©) sleeping —(@) zombie 182. Consider the following program maint) { int i = 7; fork()} lo 4¢= LO; else { wait(G); } ‘Choose the correct answers. {a) The statement.i += 10 is executed by the child only (b) The statement i += 10 is executed by the parent only (ec) The child can start executing, only after the termination of the parent process. (d) None of the above 183, ‘The value of i, printed by the above program will be print£("td*, i); (a) 10 (b) 7 © 17 (d) none of the above *184. The exception to the fact that any process in UNIX, has a parent is (a) dev (b) sh (c) kernel (@) login 185. Which of the following are shared between a parent process and a child process? (a) External variables (b) Pointer variables (c) File pointers (d) Pipes 186, Consider the following C program maint) int j + 7, *i = 83 if(0 == fork()} eio= (*i + 10); else ( wait(O); printf ("ed", *i):
You might also like
LDD Dumps
PDF
100% (3)
LDD Dumps
22 pages
Unix and Windows
PDF
No ratings yet
Unix and Windows
14 pages
Unix 241117081049 9859c384
PDF
No ratings yet
Unix 241117081049 9859c384
10 pages
Page 1 of 18 UNIX Programming
PDF
100% (1)
Page 1 of 18 UNIX Programming
18 pages
Master - Linux - Monthly Assignemnts, Question Answers, Commands, 64 Interview Q-A
PDF
No ratings yet
Master - Linux - Monthly Assignemnts, Question Answers, Commands, 64 Interview Q-A
42 pages
6 TH Chapter
PDF
No ratings yet
6 TH Chapter
170 pages
Eos MCQ
PDF
No ratings yet
Eos MCQ
189 pages
Linux System Administration Quiz 1
PDF
100% (1)
Linux System Administration Quiz 1
5 pages
Unix and Shell Programming
PDF
100% (1)
Unix and Shell Programming
50 pages
Operating System Concept
PDF
100% (1)
Operating System Concept
20 pages
C With Linux MCQs
PDF
No ratings yet
C With Linux MCQs
50 pages
Unit 3 Objective Questions
PDF
No ratings yet
Unit 3 Objective Questions
10 pages
UNIX MCQ PDF Part 2 MCQ
PDF
No ratings yet
UNIX MCQ PDF Part 2 MCQ
12 pages
1 UNIX System Calls
PDF
No ratings yet
1 UNIX System Calls
12 pages
MCQ Unix
PDF
No ratings yet
MCQ Unix
39 pages
MCQ - LPS Linux Questions
PDF
No ratings yet
MCQ - LPS Linux Questions
25 pages
OS Praticals IMP Notes by Ansar Shaikh
PDF
No ratings yet
OS Praticals IMP Notes by Ansar Shaikh
9 pages
Unix MCQs PDF
PDF
No ratings yet
Unix MCQs PDF
33 pages
Chap 8
PDF
No ratings yet
Chap 8
8 pages
IT Diploma LINUX-Operating-System-DIT3202 Old
PDF
No ratings yet
IT Diploma LINUX-Operating-System-DIT3202 Old
44 pages
Uuuuuuyyy
PDF
No ratings yet
Uuuuuuyyy
8 pages
Unit I MCQ
PDF
No ratings yet
Unit I MCQ
7 pages
Unix OS Was First Developed by
PDF
No ratings yet
Unix OS Was First Developed by
5 pages
Systems Programming Midterm Fall 2017 Answers
PDF
No ratings yet
Systems Programming Midterm Fall 2017 Answers
10 pages
Linux-Mcq With Key
PDF
No ratings yet
Linux-Mcq With Key
8 pages
QUIZ Answer Merged
PDF
No ratings yet
QUIZ Answer Merged
31 pages
Unix Sample Paper1
PDF
No ratings yet
Unix Sample Paper1
5 pages
BC0042 Operating Systems
PDF
No ratings yet
BC0042 Operating Systems
11 pages
UNIX
PDF
No ratings yet
UNIX
48 pages
UNIX Systems Questions Exam1
PDF
No ratings yet
UNIX Systems Questions Exam1
12 pages
BT0036 OPERATING SYSTEM PAPER 2 (BSciIT SEM 2)
PDF
No ratings yet
BT0036 OPERATING SYSTEM PAPER 2 (BSciIT SEM 2)
11 pages
System Programing Questions
PDF
No ratings yet
System Programing Questions
14 pages
Unix MCQ
PDF
No ratings yet
Unix MCQ
12 pages
System and Network Administration MCQs - ITEC3123
PDF
No ratings yet
System and Network Administration MCQs - ITEC3123
24 pages
Chapter-1 (Accessing The Command Line)
PDF
No ratings yet
Chapter-1 (Accessing The Command Line)
7 pages
040010401/040020202-UNIX Internal & Shell Programming
PDF
No ratings yet
040010401/040020202-UNIX Internal & Shell Programming
11 pages
DR - Nnce MCA NP-QB
PDF
No ratings yet
DR - Nnce MCA NP-QB
23 pages
Unix MCQ For Makaut Students
PDF
No ratings yet
Unix MCQ For Makaut Students
8 pages
21CS482 USP Question Paper - Watermark
PDF
No ratings yet
21CS482 USP Question Paper - Watermark
4 pages
LinuxCS 497C
PDF
No ratings yet
LinuxCS 497C
10 pages
Sysneww
PDF
No ratings yet
Sysneww
10 pages
Unix Important Questions
PDF
No ratings yet
Unix Important Questions
6 pages
OS LAB MCQ Modified
PDF
No ratings yet
OS LAB MCQ Modified
26 pages
) Acquire Resources in Same Order
PDF
No ratings yet
) Acquire Resources in Same Order
6 pages
Placement Test Questions & Answers Unix and Networking
PDF
No ratings yet
Placement Test Questions & Answers Unix and Networking
5 pages
System Notes
PDF
No ratings yet
System Notes
33 pages
Unix - MCQ
PDF
100% (1)
Unix - MCQ
23 pages
Unix MCQ
PDF
No ratings yet
Unix MCQ
43 pages
Unix MCQ
PDF
No ratings yet
Unix MCQ
9 pages
Part One - 40 Part Two - 60
PDF
No ratings yet
Part One - 40 Part Two - 60
7 pages
Unix Dumps
PDF
No ratings yet
Unix Dumps
21 pages
Linux Questions
PDF
No ratings yet
Linux Questions
5 pages
Master of Computer Applications Second Year: Unix Lab
PDF
No ratings yet
Master of Computer Applications Second Year: Unix Lab
15 pages
Linux MCQ Fot Interview
PDF
No ratings yet
Linux MCQ Fot Interview
2 pages
Unix MCQ
PDF
No ratings yet
Unix MCQ
26 pages
Ilp Pat Test Unix
PDF
No ratings yet
Ilp Pat Test Unix
6 pages
Linux MCQ Fot Interview
PDF
No ratings yet
Linux MCQ Fot Interview
2 pages
A BasicUnix Final 6
PDF
No ratings yet
A BasicUnix Final 6
6 pages