Classical

Unix - Filters and Commands

11:  

 Which of the following string functions can be used to find the last occurrence of a given character in a given string?

A.

strncmp

B.

strncpy

C.

strchr

D.

None of the above

 
 

Option: C

Explanation :

strrchr( ) is the correct function. It returns a pointer to the last occurrence of the character specified as argument.


12:  

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 a.out > out f

A. Redirects the output of date to file out f
B. Displays the output of date on the screen
C. Prints everything on the screen
D. Prints the two messages on the screen
 
 

Option: A

Explanation :


13:  

The default permission bits of a file when it is created for the first time, is controlled by

A.

chmod value

B.

fmask value

C.

umask value

D.

none of the above

 
 

Option: C

Explanation :


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
 
 

Option: C

Explanation :
The redirection symbol ›, puts everything that will otherwise
be displayed in the screen,

to the named file (y here). If x.c is syntactically correct, then the command cc x.c, silently creates a.out,
but what comes to the screen is nothing (other than the next prompt). So, y will be empty.


15:  

A file x is created with the following contents
echo today is:
date

           If you type x.then

A. It echoes the message. followed by date.
B. It gives the desired output only if the execute permission of file x is set.
C. The desired output can be got by the command sh x. which works even if x has its execute permission not set.
D. Both (b) and (c)
 
 

Option: D

Explanation :
When you create a file using an editor, it will be assigned default permission setting (determined by the umask value). Generally the execute permission will be off. So. to run a shell script, set its execute bit on. However, if you run sh x, x will be executed, even if its execute bit is off.




Suggest an improvement