Unix Operating System

Description: Unix commands
Number of Questions: 25
Created by:
Tags: Unix Linux Shell scripts commands Operating System
Attempted 0/25 Correct 0 Score 0

Which command is used to compare two files and suggest changes to make them identical?

  1. comm

  2. diff

  3. cmp

  4. dircmp


Correct Option: B
Explanation:

The diff command uses certain special symbols and instructions to indicate the changes that are required to make two files identical.

What will happen if we execute 3yy command in vi editor?

  1. Entire line will be deleted.

  2. Three lines will be copied

  3. copy three lines

  4. None of above


Correct Option: C
Explanation:

 nyy command is used to copy n number of lines to buffer , so 3yy copies three lines to buffer.

Which of the following commands is not an environment variable in unix?

  1. $TZ

  2. $DISPLAY

  3. $PWD

  4. %PATH%


Correct Option: D
Explanation:

%PATH% is an environment variable of DOS not of unix. $PATH is an environment variable of unix.

Which of the following is an invalid functioning of set command?

  1. Display a list of directories of shell searches.

  2. Specifies how the prompt is displayed in the bourne shell.

  3. Place values into the positional parameters.

  4. All of the above


Correct Option: D
Explanation:

All the above are invalid funtions of the set command.

Which of the following is not a command separator?

  1. #(hash operator)

  2. ;(semicolon)

  3. , (comma operator)

  4. / (division arithmetic operator)


Correct Option: A
Explanation:

Hash (#) because it is the interpreter line file and moves either forward or backward with the help of internal command. So, it is a not command separator.

Which command is used to delete single character in a command mode of vi editor?

  1. x

  2. $d

  3. ndd

  4. dd


Correct Option: A
Explanation:

The x command is used to delete single character in command mode in vi editor.

Which command is not used to take backup of files?

  1. cp

  2. cpio

  3. tar

  4. dump


Correct Option: A
Explanation:

The cp command copies only files, it does not take any backup of files.

What is the ouput while executing wc -l command?

  1. print the line count

  2. print the byte count

  3. print the character count

  4. print the length of the longest line


Correct Option: A
Explanation:

Wc -l is used to print the line count. 

Which of the following system calls used in phase while creating a process?

  1. fork

  2. exec

  3. wait

  4. all of the above


Correct Option: D
Explanation:

All of the above are the three distinct phases in creation of a process and use three important system calls - fork, exec and wait .

Which command is used for concatenate atleast two files vertically?

  1. paste

  2. join

  3. cat

  4. none of these


Correct Option: A
Explanation:

concatenateconcatenate corresponding lines of two files into vertical columns, separated by tab. concatenate means joining

Which command is used to schedule jobs?

  1. ruptime

  2. df

  3. crontab

  4. none of these


Correct Option: C
Explanation:

The crontab command is used to schedule jobs. You must have permission to run this command from unix administrator.

Which of the following features of UNIX may be used for inter process communication?

  1. signals

  2. pipes

  3. semaphore

  4. all of the above


Correct Option: D
Explanation:

All the above mentioned processes are interprocess communication methods.

 

To simulate the command system, which of the system calls -fork, wait, and execl is/are to be used?

  1. fork and wait

  2. fork, wait, and execl

  3. fork and execl

  4. wait and execl


Correct Option: B
Explanation:

This is the corrcet answer, i.e. all three- fork, wait and execl are to be used to simulate the command system.

Which of the following are not system calls?

  1. chmod

  2. getc

  3. iseek

  4. open


Correct Option: B
Explanation:

The getc() function is functionally similar to fgetc(),except that it is implemented as a macro. It runs faster than fgetc(), but it takes more space per invocation and it's name cannot be passed as an argument to a function call. The getc is not a system call.

Which of the following file names can be found in more than one directory?

  1. passwd

  2. bin

  3. both (1) and (2)

  4. none of these


Correct Option: C
Explanation:

In bin and passwd file,  names can be found in more than one directory.

Which of the following are not filter programs?

  1. date

  2. sort

  3. cat

  4. grep


Correct Option: A
Explanation:

The date command displays the date and time. System clock is set by the super-user with the help of date command. With no options the date command will display the current date and time. For e.g., :$date will print fri jul 16:12:06 EDT 2007. The date command is not a filter program.

Which of the following can be used to achieve redirection in pipes?

  1. >

  2. >>

  3. tee

  4. lpr


Correct Option: C
Explanation:

The tee is a program, which enables you to save a copy of the data being transmitted within a pipeline. It has only one option-a, which appends the output to the specified file, rather than replacing the contents of the file each time. So, redirection in pipes can be achieved by tee.

Which of the following programs is /are interactive?

  1. passwd

  2. date

  3. sh

  4. none of these


Correct Option: B
Explanation:

The date command displays the date and time. System clock is set by the super-user with the help of date command. With no options, the date command will display the current date and time. For e.g: $date will print  fri jul 16:12:06 EDT 2007. For display purpose it will interact, so it is interactive

Which of the following library functions do/does not return a pointer to the structure FILE?

  1. fclose()

  2. frwrite()

  3. both (1) and (2)

  4. none of these


Correct Option: C
Explanation:

Both fclose() and fwrite() are library functions which do not return a pointer to the structure FILE.

Which of the following functions can be used to randomly access a file?

  1. fgetc

  2. getc

  3. fseek

  4. all of the above


Correct Option: C
Explanation:

It is used to set the file-position indicator for the stream pointed to by the stream. The new position is measured in bytes from the begning of the file and obtained by adding offset to the position specified by whence, whose values are defined in <stdio.h>. fseek() function is used to randomly access a file. For example: int fseek(FILE *stream, long offset, int whence);

Which of the following processes has the PID 1?

  1. kernel

  2. UNIX

  3. init

  4. shell


Correct Option: C
Explanation:

Init is the program on UNIX operating systems that creates all other processes. Its primary role is to create processes from a script stored in  the file /etc/inittab. Its process ID is 1.SYNOPSIS for init is: /sbin/init [-a ] [ -s ] [ -b ] [ -z xxx ] [ 0123456Ss ]

Which of the following are implemented as macros (rather than functions)?

  1. fgetc

  2. getc

  3. getchar

  4. both (2) and (3)


Correct Option: D
Explanation:

The getc and getchar commands are implemented as macros rather than the functions.

Which of the following system calls does not return control to the calling point on termination?

  1. fork

  2. exec

  3. ioctl

  4. none of these


Correct Option: B
Explanation:

The exec overlays the calling process with the named file, then transfer to the entry point of the core image of the file. It does not return from a successfull exec call, the calling core image is lost. Because, exec family calls overlays the address space of the process that executed it. So, no chance of getting back to it.

In which of the following directories does init reside?

  1. root

  2. bin

  3. etc

  4. usr


Correct Option: C
Explanation:

UNIX Administration involves management of user accounts,the file system, hardware configuration, security, device drivers and more. To provide help, UNIX contains directory as the strorage place for all administrative files and inforamtion. etc directory contains init.

Which of the following is used to write disk block images from memory to disk?

  1. clri

  2. sync

  3. mkfs

  4. stty


Correct Option: B
Explanation:

Sync keeps all the information in the core memory that should be on disk to be written out. This contains modified i-nodes, modified super blocks and delayed input output block.This should be used by programs which examine the file system. It is mandatory before a boot Synopsis:sync()

- Hide questions