Tuesday, 2 December 2014

      Systems Programming - Unix Quiz Question and Answers - Part 3



Question 1: Write a command for clearing  the screen.
Select one:
a. CTRL-D
b. erase
c. clear 
d. delete

Question 2: Give any two names of propiretary unix
Select one:
a. CP/M, TRDOS
b. Solaris, Mac 
c. DOS, WIndows
d. Xenix, Linux

Question 3: The grep command is used for sorting the content of a file on any of the fields in the data.
Select one:
True
False 

Question 4: find / -name '*' will
Select one:
a. List a file named * in /
b. List all files and directories in / directory
c. List all files and directories recursively starting from /
d. List all files in / directory 

Question 5: perl and awk are two names for the same programming language.
Select one:
True
False 

Question 6: Which command is used to set terminal IO characteristic?
Select one:
a. ctty
b. stty 
c. tty
d. ptty

Question 7: What is the difference between cd ~ ,cd .. ,cd . and cd /
Select one:
a.
cd .. will move you up one directory.
cd ~ will move you up one directory.
cd / takes you to absolute path
cd . will leave you in the same directory you are currently in.
b.
cd .. will leave you in the same directory you are currently in.
cd ~ Move to the user's home directory.
cd / takes you to absolute path
cd . will move you up one directory.
c.
cd .. will move you up one directory.
cd ~ Move to the user's home directory.
cd / takes you to absolute path
cd . will leave you in the same directory you are currently in 
d.
cd .. will move you up one directory.
cd ~ will move you up one directory.
cd / takes you to root
cd . will leave you in the same directory you are currently in.


Question 8: How will you connect output of one command to input to other command?
Select one:
a. command > command
b. command || command
c. command | command 
d. command pipe command

Question 9: A soft link does not have the same inode number as the original directory entry of the file which is being soft-linked.
Select one:
True 
False

Question 10:What is the purpose of "rb" in fopen() function used below in the code?
FILE *fp;
fp = fopen("source.txt", "rb");
Select one:
a. Create a new file "source.txt" for reading and writing
b. None of the stated options
c. open "source.txt" in binary mode for reading and writing
d. open "source.txt" in binary mode for reading 

Question 11: The following piece of awk code 
  BEGIN { x=3 }
  { print x, $x}
Select one:
a. Does not execute as it waits for the END {} instruction. 
b. It does not give any output.
c. prints two "fields" to standard out. The first field printed is the third field (or column) on the input line, the second field printed is the number "3".
d. prints two "fields" to standard out. The first field printed is the number "3", the second is the third field (or column) on the input line.
e. prints one "field" to standard out. It is the third field (or column) on the input line.

Question 12: AWK has an incredible useful feature which most computing languages lack. It is
Select one:
a. associative arrays 
b. object oriented
c. interpreted oriented.
d. procedural
e. it is a dynamic programming languages

Question 13: Which command is used to print a file
Select one:
a. lpr 
b. ptr
c. print
d. none of the given options

Question 14: What is the role of the kernel in UNIX?
Select one:
a. It handles the filestore and communications in response to system calls.
b. It allocates time and memory to programs and handles the filestore and communications in response to system calls.
c. It allocates memory to programs and handles communications in response to system calls. Incorrect
d. It allocates time and memory to programs.

Question 15: When you hard link a new directory entry is generated with the same inode number in the new entry as that in the old directory entry.
Select one:
True 
False

Question 16: Which command is used to display the operating system name
Select one:
a. uname 
b. myos
c. kernel
d. os

Question 17: The following piece of awk code 
  BEGIN { x=3 }
  { print x, $x}
Select one:
a. It does not give any output.
b. prints two "fields" to standard out. The first field printed is the third field (or column) on the input line, the second field printed is the number "3".
c. prints one "field" to standard out. It is the third field (or column) on the input line.
d. Does not execute as it waits for the END {} instruction. 
e. prints two "fields" to standard out. The first field printed is the number "3", the second is the third field (or column) on the input line.

Question 18:The command
cmp file1 file2 
indicated the line number and character number at which the two files file1 and file2 differ for the first time as you parse through both files.
Select one:
True 
False

Question 19: Which command is used to record a user login session in a file
Select one:
a. read
b. script 
c. none of the given choices
d. macro

Question 20:What does fp point to in the program ?
#include<stdio.h>
int main()
{
    FILE *fp;
    fp=fopen("trial", "r");
    return 0;
}
Select one:
a. The name of the file.
b. The first character in the file
c. The last character in the file.
d. A structure which contains a char pointer which points to the first character of a file.

Question 21: Which option of ls command used to view file inode number
Select one:
a. -a
b. -l
c. -o
d. -i 

Question 22: Write the difference between rm and mv command.
Select one:
a. rm remakes file, mv moves file.
b. rm removes file, mv moves file. 
c. rm renames file, mv makes variable.
d. rm renames file, mv makes variable.

Question 23: Write a command to display files with permissions, number of hard links, owner, group, size, date and filename.
Select one:
a. ls -a
b. ls -l 
c. ls -i
d. ls -o

Question 24: who | grep tulsi
will only show the details of the the user tulsi is she is logged in at the time this command is executed.
Select one:
True 
False

Question 25: The name awk comes from
Select one:
a. Aho, Kernighan and Weinberger 
b. a.w.k.jones, salty
c. awake my soul
d. awkward

            Systems Programming - Unix Quiz Question and Answers - Part 2


Question 1: Which command is used to copy all files having the string chap and any two characters after that to the progs directory?
Select one:
a. cp chap[12] /progs/*.*
b. cp chap?? progs 
c. None of the given answers
d. cp chap* progs
e. cp chap?? /progs/*

Question 2: In Linum the file /etc/passwd contains:
Select one:
a. Only password
b. Password, user id and group id only
c. The name of default shell and home directory besides other infomation.
d. Password and user id only.
e. all information about user rights Incorrect

Question 3: Xenix system is a property of 
Select one:
a. Linux Corporation
b. Lotus Corp
c. Sun
d. Microsoft 
e. IBM

Question 4: The command
wc section1.*
will only print the total lines, words, and characters for all files having the name starting with 'section1.' put together. The output appears in 1 line.
Select one:
True
False 

Question 5:If you use the ls command with the option -la
ls -la 
Select one:
a. lists files from archives
b. system and hidden files are also listed and the list is on long format 
c. All files are lists just list with -l option
d. lists the files in the order of last access
e. List the files in the order of least age

Question 6: Comment on the command given below:
man man
Select one:
a. This is a typing mistake.  Gives the same responce as typing once.
b. Returns and indication of error.
c. This is a typing mistake.  Should have been typed only once.
d. Only lists the options available under the man command.
e. Provides man details about man 

Question 7: Which of the following files contains information related to password aging?
Select one:
a. shodow
b. profile
c. password Incorrect
d. none of the given choices
e. all 3 given choices

Question 8: Holding the CONTROL key and pressing 'd' is equivalent to pressing the RETURN key.
Select one:
True
False 

Question 9: Which of these statements is true about the UNIX Kernel
Select one:
a. Provides service to user applications such as device management, process scheduling, etc.
b. None of the given statements.
c. Manages the entire resources of the system, presenting them to you and every other user as a coherent system. 
d. All 3 of the given statements. 
e. Loaded at system start up (boot). Memory-resident control program.

Question 10: Which of the following commands is used to copy a file wb from the programs directory into a file called wbx in the misc directory?
Select one:
a. cp programs/wb misc/wbx 
b. tar programs/wb misc/wbx
c. None of the given options
d. copy programs/wb misc/wbx
e. copy a:programs/wb b:misc/wbx

Question 11: UNIX uses the mv command to rename a file.
Select one:
True 
False

Question 12: The octal representation 652 indicates
Select one:
a. None of the given options.
b. Read and write permission of groups
c. Write permission for others 
d. Execute permission for the owner

Question 13: Special characters . (dot), .. (double dot) and ~ (tilde) are used in the path name.
Tilde stands for:
Select one:
a. User's home directory.
b. current directory
c. Root Directory Incorrect
d. default directory
e. Current Directory

Question 14: The Official Trademark of Unix is
Select one:
a. None of the given choices
b. All 3 of given choices
c. Unix
d. UNIX Correct
e. Linux

Question 15: Which of the following commands is used to rename a file?
Select one:
a. rn
b. rename
c. ren
d. mv 
e. remove

                  Systems Programming - Unix Quiz Question and Answers



Question 1: When you use the cp command in UNIX to copy a file, the file is not actually duplicated but only a new directory entry is generated to the same physical file. It is because of this that copying is sometimes called hard linking.
Select one:
True
False

Question 2: The command pwd is an acronym for Print Working Directory.
Select one:
True
False

Question 3
The who command only tells the name, type and login date and time of the current logged in user who is issuing this command.
Select one:
True
False

Question 4: The Linux Operating System consists of
Select one:
a. Only kernel
b. Utilities, drivers and libraries
c. Utilities and Libraries
d. shell, Kernel, Utilities, drivers and libraries 
e. Kernel, Utilities, drivers and libraries

Question 5: Which of the following is not a UNIX OS
Select one:
a. HP-UX
b. Ubuntu 
c. Sun Solairs
d. IBM AIX
e. Mac OS X

Question 6: When the command ls is types with option -li as
ls -li
the output will include
Select one:
a. Long file name with path
b. long format and inode number 
c. Show list in indexed order
d. None of the provided options
e. show values of large intergers

Question 7: Which of these is true about UNIX
Select one: 
a. Multiprocessing only
b. None of the given choices
c. Multiuser only
d. Mutlitasking only
e. All 3 of given choices 

Question 8: .profile file.  Which of these statements is not true about this file.
Select one:
a.The .profile file contains your individual profile that overrides the variables set in the /etc/profile file. 
b.The .profile file is never used to set exported environment variables and terminal modes. 
c. The .profile file is present in your home ($HOME) directory 
d. It lets you customize your individual working environment.
e. Because the .profile file is hidden, use the ls -a command to list it

Question 9: UNIX was originally developed  by a group of AT&T employees at Bell Labs in
Select one:
a. 1973
b. 1989
c. 1969 
d. 1979
e. Year 2K

Question 10: UNIX trademark is owned by
Select one:
a. Open Group 
b. Bell Labs
c. UNIX Corporation
d. IBM
e. AT&T