1. Which of the following system calls can be used to send a message via a connected socket?

Answers:

  1. send
  2. sendto
  3. sendmsg
  4. write

2. Which of the following methods can be used as a communication mechanism between two unrelated processes?

Answers:

  1. A pipe using the pipe system call.
  2. A named pipe using the mknod system call.
  3. Named sockets.
  4. Signals.

3. Which of the following are true of Unix system calls?

Answers:

  1. System calls are executed in “User” context.
  2. The routine “malloc” which is used for allocating memory is a system call.
  3. A new file can be created using the “open” system call.
  4. If two processes are executing the “write” system call simultaneously, they are serialized by the operating system.
  5. The “read” system call will never be blocked.

4. Which of the following Linux commands can be used to identify the processes consuming maximum resources (CPU, Memory)?

Answers:

  1. ps
  2. top
  3. lsof
  4. vmstat

5. Which of the following signals are used by the Unix shell to implement job control?

Answers:

  1. SIGHUP
  2. SIGSTOP
  3. SIGCONT
  4. SIGINT

6. Which of the following environment variables specifies the shared library search path?

Answers:

  1. SHARED_LIBRARIES
  2. SHLIB_PATH
  3. LD_LIBRARY_PATH
  4. LIBRARIES

7. Which of the following statements are true?

Answers:

  1. “wc -l” can be used to count the number of lines in the input.
  2. “find . -name ‘*.txt’ -exec rm {} ;” removes all “.txt” files in the current directory hierarchy.
  3. “cc -x ” can be used to generate the assembler listing of the C program file.
  4. “set -x” can be used within a ksh shell script to generate listing of shell commands while they are being executed.

8. Which of the following utilities would you use on a standard Linux system to debug a running application?

Answers:

  1. gdb.
  2. ltrace.
  3. strace.
  4. ptrace.

9. Which of the following can be used to inspect the system call arguments of a Linux process?

Answers:

  1. strace
  2. gdb
  3. adb
  4. mdb

10. Which of the following methods can be used to allocate and use memory on a Unix system?

Answers:

  1. brk
  2. sbrk
  3. malloc
  4. calloc

11. Which of the following utilities is used to generate a core file of a process on Linux?

Answers:

  1. gdb
  2. strace
  3. gcore
  4. objdump

12. Which of the following can be used to debug the process “123” and program “test” on a Linux system?

Answers:

  1. adb test 123
  2. gdb test 123
  3. strace 123
  4. strace -f -p 123

13. If a process has locked a System V Semaphore and receives a SIGKILL signal, which of the following is true?

Answers:

  1. The process can catch the signal and drop the semaphore before terminating.
  2. The process terminates without releasing the semaphore.
  3. The semaphore is released if the process had specified SEM_UNDO during creation.
  4. The signal is deferred until the semaphore is released.

14. Which of the following gdb commands can be used to obtain the stack

trace of all the threads of a multi threaded program running on Linux?

Answers:

  1. bt
  2. ::stack
  3. $C
  4. thread apply all bt

15. Which of the following shell commands is useful in single stepping through a shell script?

Answers:

  1. set -x
  2. echo
  3. trap
  4. DEBUG

16. Which of the following utilities is used to search out regular expressions in the input?

Answers:

  1. cat
  2. grep
  3. head
  4. tail

17. What does the command “mknod temp p” do?

Answers:

  1. It creates a named pipe.
  2. It creates directory nodes “temp” and “p”.
  3. It creates pipes “temp” and “p”

18. Threads created via pthread_create need to first set up shared memory
using shmop before they can share data.

Answers:

  1. True
  2. False

19. What does the “open” system call return to the caller?

Answers:

  1. 0 on success and -1 on error.
  2. File descriptor.
  3. An integer greater than or equal to 0 on success and -1 on error.
  4. Always 0.

20. What is the effect of a process executing an unlink system call while another process has opened the same file?

Answers:

  1. The unlink system call will fail.
  2. The unlink system call will succeed and the other process will be terminated.
  3. The unlink system call will be blocked until the other process has closed all references to the file.
  4. The unlink system call will succeed.

21. Which of the following signals cannot be ignored by a process?

Answers:

  1. SIGHUP
  2. SIGINT
  3. SIGTERM
  4. SIGKILL

22. Ignoring the setup cost for each of the System V IPC mechanisms, which of the following is the most efficient?

Answers:

  1. System V, Messages.
  2. System V, Shared Memory
  3. System V, Semaphores
  4. Sockets

23. What command is used to list the shared libraries used by an executable?

Answers:

  1. ldconfig
  2. ld
  3. ldd
  4. ls

24. What does the following command do to the process with pid 12345?
“kill -9 12345”.

Answers:

  1. It sends the INT signal causing the process to be interrupted.
  2. It sends the STOP signal causing the process to be stopped.
  3. It sends the KILL signal causing the process to be killed.
  4. It sends the HUP singal causing the process to hangup.

25. Which of the following system calls is the most memory efficient method of reading a file?

Answers:

  1. readv
  2. read
  3. mmap
  4. fcntl

26. Which of the following commands generates a listing of the system calls being executed by a program on Solaris?

Answers:

  1. ltrace
  2. tusc
  3. strace
  4. truss

27. What is the effect of issuing a “$c” command at the adb prompt during a debugging session on a Solaris 9 system?

Answers:

  1. It generates a listing of the stack trace.
  2. It causes the debugger to continue.
  3. It drops to the shell.
  4. It prints the register contents.

28. Which of the following sequences prints all the second column fields of an input file “values.txt”?

Answers:

  1. awk “print $2” values.txt
  2. awk ‘{print $2}’ values.txt
  3. awk ‘{print #2}’ values.txt
  4. cut -2 values.txt

29. Which of the following system calls increases the process priority?

Answers:

  1. priority
  2. nice
  3. ulimit
  4. fcntl

30. Which of the following is true of Unix system calls?

Answers:

  1. System calls cannot be executed by regular users.
  2. System calls are executed in the user context.
  3. System calls are executed in the kernel context.
  4. System calls cause a process switch.

31. If a process is hung in the kernel context, sending it a SIGKILL will _____.

Answers:

  1. kill the process immediately.
  2. be ignored by the Operating System.
  3. be delivered when the process switches back to the user context.

32. The library routine printf does not use any system calls.

Answers:

  1. True.
  2. False.

33. Which of the following gcc compiler options turns on optimization?

Answers:

  1. optimize
  2. O
  3. Opt
  4. -S

34. Which of the following options of the compiler is turned on to generate additional debug information (like the source code) for debugging an application?

Answers:

  1. O
  2. S
  3. E
  4. g

35. Which of the following options specifies a non standard library path during linking?

Answers:

  1. -l
  2. -L
  3. -o
  4. -g

36. Which of the following shell operators redirects the standard input of the command being executed?

Answers:

  1. <
  2. >
  3. %
  4. @

37. Which library routine is used to translate the numeric system call error code to a human readable text error message?

Answers:

  1. sprintf
  2. exit
  3. error
  4. perror

38. Which of the following IPC message operations is performed to setup communication between arbitrary processes?

Answers:

  1. msgctl
  2. msgsnd
  3. msgrcv
  4. msgget

39. What is the effect of executing the following system call on the file “test.txt”?
open(“test.txt”, O_TRUNC)

Answers:

  1. The file is truncated to the nearest block size before returning.
  2. The file is created before returning.
  3. The file is opened.
  4. If test.txt exists, the file is truncated to 0 bytes before returning.

40. How does a programmer distinguish a child from its parent process following a fork system call?

Answers:

  1. The system call returns 0 to the child and 1 to the parent.
  2. The system call returns 0 to the parent and the pid of the parent to the child.
  3. The system call returns 0 to the child and the pid of the child to the parent.
  4. There is no way to distinguish a child from its parent.

41. Which of the following libraries provides the POSIX thread implementation on Solaris?

Answers:

  1. libpthread
  2. libthread
  3. libnptl
  4. libc

42. Which of the following IPC shared memory sequences is correct?

Answers:

  1. shmctl, shmat, shmdt
  2. shmget, shmat, shmdt
  3. shmctl, shmget, shmat, shmdt
  4. shmat, shmdt

43. How is the value of the shell environment variable IFS changed to comma (‘,’)?

Answers:

  1. IFS=’,’; export IFS
  2. $IFS=’,’; export IFS
  3. IFS=’,’; export $IFS
  4. $IFS=’,’

44. Which of the compiler options generates an assembler output file?

Answers:

  1. -O
  2. -a
  3. -S
  4. -g

45. What does the ‘-pg’ option of the Unix compiler do?

Answers:

  1. It turns on the profiling of the executable code.
  2. It generates an assembler listing of the code.
  3. It turns on the generation of the optimized code.
  4. It prints the different function call graphs.

46. Shared libraries increase an application’s disk size?

Answers:

  1. True.
  2. False.

47. Which of the following redirects the standard error output of a command to the log file “error.log”?

Answers:

  1. “2>error.log”
  2. “2
  3. “>error.log”
  4. “|error.log”

48. What are the typical system calls the Unix shell invokes when it
has to execute a new command?

Answers:

  1. open, read, close.
  2. open, fork, exec.
  3. ioctl.

49. Which system call is used to send a signal to another process?

Answers:

  1. signal
  2. kill
  3. socket
  4. ioctl

50. Which of the following commands can be used to generate a listing of all the shared libraries that an executable needs?

Answers:

  1. ld
  2. ldd
  3. ls
  4. ln

51. What is the default file descriptor used for the error outputs of a process?

Answers:

  1. 0
  2. 1
  3. 2
  4. -1

52. Which of the following commands can be used on a Linux system to kill process 8977 and all its children?

Answers:

  1. kill -term 8977
  2. kill -kill 8977
  3. kill -stop 8977
  4. kill -int 8977

53. Which of the following commands can be used on a Linux system to configure a network interface (card)?

Answers:

  1. ifconfig
  2. ipconfig
  3. netstat -c
  4. route

54. Which of the following commands can be used to list all the active TCP connections only on a Linux system?

Answers:

  1. netstat -r
  2. netstat -t
  3. iptables -L
  4. route

55. Which of the following ksh trap sequences causes the function ‘handler’ to be executed when the script exits?

Answers:

  1. trap handler EXIT
  2. trap EXIT handler
  3. set handler EXIT
  4. trap handler exit

56. How many bytes of a file of size 1023 will be read by the following piece of code?

char buf[256];

<snip>
while (read(fd, buf, 256)) {
/* Take some action */
}
<snip>

Answers:

  1. 1024
  2. 1023
  3. 0
  4. 768

57. What is the effect of setting the “sticky” bit on an application’s executable image?

Answers:

  1. It causes the system to load the program faster the next time it runs.
  2. It causes the system to fail all unlink system call requests on the image.
  3. It causes the system to preload the application’s image into the system RAM.
  4. It causes the system to grant the application owner’s privileges to other users if they try to run the application.

58. A C program “domath.c” utilizes the math library. Which of
the following commands correctly creates the corresponding executable
“domath”?

Answers:

  1. cc -o domath domath.c
  2. cc -o domath domath.c -L /usr/lib -lmath
  3. cc -o domath domath.c -lm
  4. cc -o domath domath.c -Lmath

59. Which of the following sequences creates a socket based connection for communication?

Answers:

  1. open, listen, accept
  2. open, accept, listen
  3. socket, connect, accept, listen
  4. socket, connect, listen, accept

60. What does the open system call return upon success?

Answers:

  1. A non zero value, which is the file descriptor.
  2. Zero.
  3. A positive integer which is the file descriptor.
  4. The pointer to the FILE structure of the open file.

61. If a process executes the following C code on a Linux system, what is the outcome?

<snip>
char *cp = 0, c = *cp;
<snip>

Answers:

  1. The process executes the code without errors.
  2. The process is killed with a SIGSEGV.
  3. The process is killed with a SIGBUS.
  4. The process is killed with a SIGKILL.

62. On Linux, the pthread_create interface does not use the fork system call to create threads.

Answers:

  1. True.
  2. False.

63. Which of the following shell parameters contains the return value of the previously executed shell command?

Answers:

  1. $*
  2. $$
  3. $?
  4. $!

64. Which of the following calls is used to initiate a socket connection to a target address?

Answers:

  1. socket
  2. connect
  3. accept
  4. listen

65. Which of the following gcc options can be used to generate a position independent code on a Linux system?

Answers:

  1. -pic
  2. +z
  3. -b
  4. -mshared

66. Which of the following commands can be used to list all the active TCP connections on a Linux system?

Answers:

  1. netstat -r
  2. netstat -t
  3. iptables -L
  4. route

67. What is the network byte order in Unix?

Answers:

  1. Little Endian
  2. Big Endian
  3. It is negotiated during connection.
  4. It is undefined.

68. Which of the following segments within the process address space are unique to each thread?

Answers:

  1. code.
  2. data.
  3. stack.
  4. bss.

69. How do threads created using pthread library share data between themselves efficiently?

Answers:

  1. They use one of the standard interprocess communication methods.
  2. They use sockets.
  3. They don’t need any special mechanism as they share the data segment.
  4. They use shared memory.

70. By convention, which of the following signals causes a daemon to reload its configuration?

Answers:

  1. SIGHUP
  2. SIGKILL
  3. SIGINT
  4. SIGCONT

71. Which of the following block sizes results in the best read/write performance for an IO intensive application?

Answers:

  1. 8192
  2. 4096
  3. 2048
  4. 1024

72. What is the name of the standard linker on Unix?

Answers:

  1. cc
  2. ldd
  3. ld
  4. ls

73. Which of the following is employed by the operating system to speed up file IO on a Solaris system.

Answers:

  1. Inode Cache
  2. DNLC
  3. Buffer Cache
  4. Page Cache

74. How is the stack trace of all the threads in a multi threaded Linux application obtained?

Answers:

  1. strace -f -p <procid>
  2. “backtrace” at the gdb prompt.
  3. “thread apply all ::stack” at the gdb prompt.
  4. “thread apply all backtrace” at the gdb prompt.

75. Which of the following creates an IPC message channel?

Answers:

  1. id = msgget(key, 0700|IPC_CREAT);
  2. id = msgget(key, 0700, IPC_CREAT);
  3. id = msgctl(key, 0700|IPC_CREAT);
  4. id = msgctl(key, IPC_CREAT, 0700);

76. Which of the following system calls can be used to get the metadata of a file?

Answers:

  1. open
  2. stat
  3. fcntl
  4. ioctl

77. Which of the following commands can be used to create a static (archive) library?

Answers:

  1. tar
  2. ar
  3. ld
  4. gcc

78. Which of the following system calls is specific to debugging?

Answers:

  1. truss
  2. fcntl
  3. strace
  4. ptrace

79. Which of the following commands can be used to compile a C file called “test.c” into an executable called “test”?

Answers:

  1. cc -o test test.c
  2. cc -g -S test.c
  3. cc test test.c
  4. cc -E test.c

80. Which of the following IO mechanisms allows greater performance to concurrent IO-intensive applications?

Answers:

  1. Memory Mapped IO
  2. Read Ahead
  3. Direct IO (Filesystem locking is skipped)
  4. Async IO.

81. What is the outcome of attempting an ioctl system call on a block device file?

Answers:

  1. The system returns ENOTTY.
  2. The ioctl succeeds and returns 0.
  3. The system returns EIO.
  4. The system returns ENXIO.

82. Which of the following system calls can be used to create device special files?

Answers:

  1. open
  2. mkfs
  3. touch
  4. mknod

83. If a process is terminated due to a SEGFAULT on a Solaris 9 system, what is the name of the core file that is created?

Answers:

  1. core
  2. corefile
  3. memdump
  4. coredump

84. Which of the following socket system calls creates a Unix Domain Socket connection?

Answers:

  1. socket(PF_UNIX, SOCK_STREAM, protocol)
  2. socket(PF_INET, SOCK_DGRAM, protocol)
  3. socket(PF_IPX, SOCK_RAW, protocol)
  4. socket(PF_LOCAL, SOCK_STREAM, protocol)

85. Which of the following system calls creates a named socket?

Answers:

  1. creat
  2. mknod
  3. bind
  4. socket

86. Which of the following shell operators is used to send the standard output of the first command to the standard input of the second command?

Answers:

  1. &
  2. ^
  3. >
  4. |

87. Which of the following C headers needs to be included for socket programming?

Answers:

  1. <socket.h>
  2. <sys/socket.h>
  3. <stdio.h>
  4. <stdlib.h>

88. Where are the DNS and search domains specified?

Answers:

  1. /etc/fstab
  2. /etc/nsswitch.conf
  3. /etc/resolv.conf
  4. /etc/hosts-

89. A process opens a file and forgets to close the file descriptor when it
exits. What is the result?

Answers:

  1. It results in a resource leak.
  2. The OS calls exit on behalf of the process before it terminates the process resulting in all the resources being reclaimed.
  3. The OS garbage collector recovers the descriptor.

90. If a write system call fails and if errno is set to EFAULT, what does it signify?

Answers:

  1. The system encountered an IO error while doing the write.
  2. The file descriptor was illegal.
  3. The write buffer is not legal.
  4. The file was removed by another process while this write was being attempted.

91. Which of the following commands can be used to install the native software package SOFTpkg on a Solaris system?

Answers:

  1. tar -xvf SOFTpkg
  2. swinstall -s `pwd` SOFTpkg
  3. rpm -i SOFTpkg
  4. pkgadd -d . SOFTpkg

1,166 total views, 1 views today