1. Where would you expect to encounter the following code? for (i=1; i<argc; i++) { if (argv[i][0] == '-') {
2. What does the following line do? memset((char *)&ctl_addr, 0, sizeof(ctl_addr));
3. Which one of the following is NOT applicable in real-time Systems Programming?
4. When communicating across sockets, which of the following functions must be used when the socket is in a connected state?
5. Using a terminal you want to log in to an account on a remote computer and securely build. Which would you use?
6. You see the line: listen (s, 3); You are looking at code for:
7. Race conditions are caused by which of the following conditions in a multithreaded system?
8. Some programme that streams data to a hard-disk file in a loop crashed before it closed the FILE pointer. When the output file is inspected side-by-side with the logs, it is clear that the fprintf() function previous to the crash was unsuccessful. Such a situation can be averted using which one of the following?
9. You want to listen on a port for some user-defined data stream. Would you use port 80?
10. Using strncpy() to copy strings can help prevent which of the following attacks?
11. An orphan process occurs as a result of which of the following conditions?
12. The language of choice for Systems Programming is:
13. You want the same codebase to conditionally compile on and for different target platforms. Which of the following would you use?
14. Threads and processes are related in which one of the following ways?
15. If a function is a 'blocking function' then:
16. Which of the following is true of hard links?
17. Given the following line: my_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_APPEND, 0644); Which statement is true?
18. The purpose of the poll() and select() system calls is to perform which of the following functions?
19. If you see: int ff; write(ff, data, sizeof(data)); you know that ff is:
20. Is it good programming that the following function call is recursive? void func(unsigned long a) { unsigned long x; struct t_struct[] *p; : p = (struct t_struct *)alloca(a*sizeof(t_struct)); : While (x = f2()) func(x); : return; }
21. What is thread safety?
22. Which of the following fields in the stat struct contain last time the file was modified?
23. The sticky bit is used to enable which of the following features?
24. Which of the following is correct for the standard file descriptors that are automatically opened in UNIX?
25. When a new process is created using fork(), which of the following describes the state of open file descriptors?
26. Which of the following provides the most random seed source for a pseudo random number generator?
27. Which of the following methods is used by system programs to access a character device (such as keyboards, audio cards, etc) on a UNIX system?
28. Any code that calls a function whose interface includes the line raises(aLibrary:BookIsMissing); should do which one?
29. Which of the following IPC mechanisms has an inode?
30. Correct the following code: 10 int my_sock; : 20 my_sock = socket(anaddr.sin_family, SOCK_STREAM, 0); 21 if (my_sock >= 0) { /* error processing */ : }
31. Thrashing caused by loading a large file can be reduced by mapping the file to memory due to which of the following features?
32. Which of the following best describes the purpose of the unlink() call?
33. The ioctl() function is used to interact with which of the following?
34. Using two resident processes on a PC and a Unix box, you are streaming unbuffered the contents of a text-file byte by byte from the PC to the Unix box where it is written byte by byte to the local hard disk. Eyeing the written file it is obvious that it is not quite right. You have likely run into which problem?
35. Given: int s, l; struct sockaddr_un sock_struct; Choose the option that corrects the following line: bind(s, sock_struct, l);
36. Which of the following could the fork() command return to the child process?
37. In UNIX, a program requires higher privileges in order to do which of the following?
38. What does the following function return? Class retVal = [self class]; if ([retVal class] != [NSObject class]) { while ([retVal superclass] != [NSObject class]) retVal = [retVal superclass]; } return retVal;
39. Thread joining synchronizes threads by doing which of the following?
40. Which of the following can be called to remove zombie processes?
41. When there are more fork() calls than wait() calls, which of the following is created?
42. The following code is written to be accessed by multiple detached threads. : const char * c; char * d; : /* no lock and no mutex is used in any way here */ my_print_func (c, &d); : Which one of the following will happen when this code is re-entered by multiple threads?
43. Which of the following is an advantage of using pipes over shared memory for interprocess communication?
44. You want a char * that will contain the timestamp as YYYYMMDD-hh:mm:ss . You would use:
45. What does the line #define S_IRWXG 0000070 relate to?
46. What type of attack can be mitigated by using ulimit, setrlimit(), and quotactrl()?
47. In Multi-Threaded programming you want an active thread to push itself back in the background in favour of some other thread. You will use which function:
48. What is a UNIX directory?
49. In order to prevent signal handler race conditions, a developer must do which of the following?
50. Which one is not a difference between exit() and _exit()?
51. A thread has its own copy of which of th following?
52. You want to copy binary contents of memory from one location to another. Which one of these h-files will you #include?
53. In an IDL which one of the following is NOT a valid declaration?
54. Which of the following is the result of a process calling UNIX exec()?
55. Sharing memory between processes using mmap vs. shm_open has which of the following advantages?
56. CORBA's DII allows a client to do which one of the following?
57. Which of the following advocates the use of memmove() over memcopy() for performing fast data copying from one buffer to another correctly?
58. What will happen when the compiler 'sees' the following code? #define FTP_TYPE "" #ifdef -FTP #define FTP_TYPE "FTP" #elif #ifdef -PASV #ifndef FTP_TYPE #define FTP_TYPE "PASV" #endif #endif
59. Which is true, given the following code: tok = strtok_r(data, " ”, &last); while (tok) { strcat(strcpy(full_name, the_path), tok); make_secondary(eAma_full_name, TRUE); tok = strtok_r(NULL, " ”, &last); }
60. What is the purpose of a semaphore?
61. A 'crashed' software needs to be debugged using its core dump. You would start by doing:
62. Given: int s, l; struct sockaddr_un sock_struct; The following function call: connect(s, &sock_strict, l); fails. Which one is NOT a reason for it to fail?
63. In a Publish-And-Subscribe implementation, a subscriber must:
64. In gdb before using 'jump' you would typically do which one of the following:
65. Which of the following techniques can help keep system programs secure?
66. Calling mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, input_fd, 4096), where input_fd is the file descriptor of a 16KB file will cause which of the following to occur?
67. Wha does the following line do? unsigned transOK : 1;
68. The result of calling kill(6003, 0) is which of the following?
69. An Internet socket connection essentially is:
70. How can two processes communicate despite having firewalls between them?
71. Which of the following functions sends a signal to the executing process?
72. You are coding a multi-threaded server in which n detached threads will listen on n ports with a permanent one-to-one association between threads and ports during the lifetime of the process. You want to uniquely identify each thread-port pair. To do so you:
73. Yousee the following function call in some code: pthread_setspecific(key, value); What will this allow the coder to do?
74. Changing the mode of a file to be -rwxr-xr-x via the chmod system call can be achieved by setting the mode to which of the following values?
75. In order to create a counting mutex, which mode does it need to use?
76. Which one of the folloing is NOT necessary for a basic CORBA system?
77. Choose the answer that corrects the following code. FILE * file1; : if ((file1 = open("/valid_dir/existing_file", O_RDONLY, 0666)) == ERROR) { /* /valid_dir/existing_file is guaranteed to exist */ :
78. A pipe has been created, and fork() and exec() calls have been completed. What steps must be taken next in order to establish communication from the parent to the child?
79. Which of the following could the fork() command return to the parent process?
80. What does this code do: [aLock lockWhenCondition:(int)self beforeDate:[NSDate dateWithTimeIntervalSinceNow:maxTimeInterval]];
81. In a Unix toolchain, which one of these pairs does not fit with the others?
82. It is not possible to set the sticky bit of a file when creating it. Therefore it is necessary to create the directory and then set the sticky bit by executing: mkdir(“/tmp/dir”, 0744); chmod(“/tmp/dir”, 07744). Why?
83. Recently your office's UNIX tool-chain was updated. Now, code that previously used to build and run still builds without any warnings or errors but displays load-time errors due to symbols not found in shlibs. You have ensured that all necessary shared libraries are present in the path 'pointed to' by the appropriate environment variable. Which is true?
84. What does this code do: BOOL sharedLockSuccess = NO; NSLock *aMutex; : sharedLockSuccess = [aMutex lockWhenCondition:1 beforeDate:[NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval)3600]]; :
85. Which system call can be used to send a message via a connected socket?
86. Which are true of Unix system calls?
87. Which gdb command can be used to obtain the stack trace of all the threads of a multi threaded program running on Linux?
88. Which method can be used as a communication mechanism between two unrelated processes?
89. Which Linux command can be used to identify the processes consuming maximum resources (CPU, Memory)?
90. Which signals are used by the Unix shell to implement job control?
91. Which environment variable specifies the shared library search path?
92. Which utility would you use on a standard Linux system to debug a running application?
93. How to inspect the system call arguments of a Linux process?
94. How to to allocate and use memory on a Unix system?
95. Which utility is used to generate a core file of a process on Linux?
96. How to debug the process '123' and program 'test' on a Linux system?
97. If a process has locked a System V Semaphore and receives a SIGKILL signal, which one is true?
98. Which utility is used to search out regular expressions in the input?
99. What does the command 'mknod temp p' do?
100. Threads created via pthread_create need to first set up shared memory using shmop before they can share data.
101. What does the 'open' system call return to the caller?
102. Effect of a process executing an unlink system call while another process has opened the same file?
103. Which signal cannot be ignored by a process?
104. Ignoring the setup cost for each of the System V IPC mechanisms, which one is the most efficient?
105. Command to list the shared libraries used by an executable?
106. What does the command do to the process with pid 12345?
107. Which system call is the most memory efficient method of reading a file?
108. Which command generates a listing of the system calls being executed by a program on Solaris?
109. Effect of issuing a '$c' command at the adb prompt during a debugging session on a Solaris 9 system?
110. Which sequence prints all the second column fields of an input file 'values.txt'?
111. Which system call increases the process priority?
112. Which one is true of Unix system calls?
113. If a process is hung in the kernel context, sending it a SIGKILL will _____.
114. The library routine printf does not use any system calls.
115. Which gcc compiler option turns on optimization?
116. Which option of the compiler is turned on to generate additional debug information (like the source code) for debugging an application?
117. Which option specifies a non standard library path during linking?
118. Which shell operator redirects the standard input of the command being executed?
119. Which library routine is used to translate the numeric system call error code to a human readable text error message?
120. Which IPC message operation is performed to setup communication between arbitrary processes?
121. Effect of executing the following system call on the file ''test.txt''?
122. How does a programmer distinguish a child from its parent process following a fork system call?
123. Which library provides the POSIX thread implementation on Solaris?
124. Which IPC shared memory sequences is correct?
125. How is the value of the shell environment variable IFS changed to comma (',')?
126. Which compiler options generates an assembler output file?
127. What does the '-pg' option of the Unix compiler do?
128. Shared libraries increase an application's disk size?
129. Which redirects the standard error output of a command to the log file 'error.log'?
130. Typical system calls the Unix shell invokes when it has to execute a new command?
131. Which system call is used to send a signal to another process?
132. Which shell command is useful in single stepping through a shell script?
133. Which command can be used to generate a listing of all the shared libraries that an executable needs?
134. Default file descriptor used for the error outputs of a process?
135. Which command can be used on a Linux system to kill process 8977 and all its children?
136. Which command can be used on a Linux system to configure a network interface (card)?
137. Which command can be used to list all the active TCP connections only on a Linux system?
138. Which ksh trap sequence causes the function 'handler' to be executed when the script exits?
139. How many bytes of a file of size 1023 will be read by the following piece of code?
140. Effect of setting the 'sticky' bit on an application's executable image?
141. A C program 'domath.c' utilizes the math library. Which command correctly creates the corresponding executable 'domath'?
142. Which sequence creates a socket based connection for communication?
143. What does the open system call return upon success?
144. If a process executes the following C code on a Linux system, what is the outcome?
145. On Linux, the pthread_create interface does not use the fork system call to create threads.
146. Which shell parameter contains the return value of the previously executed shell command?
147. Which call is used to initiate a socket connection to a target address?
148. Which gcc option can be used to generate a position independent code on a Linux system?
149. What is the network byte order in Unix?
150. Which segment within the process address space are unique to each thread?
151. How do threads created using pthread library share data between themselves efficiently?
152. By convention, which signal causes a daemon to reload its configuration?
153. Which block size results in the best read/write performance for an IO intensive application?
154. Name of the standard linker on Unix?
155. Which one is employed by the operating system to speed up file IO on a Solaris system.
156. Which one creates an IPC message channel?
157. Which system calls can be used to get the metadata of a file?
158. Which command can be used to create a static (archive) library?
159. Which system call is specific to debugging?
160. Which command can be used to compile a C file called 'test.c' into an executable called 'test'?
161. Which IO mechanism allows greater performance to concurrent IO-intensive applications?
162. Outcome of attempting an ioctl system call on a block device file?
163. Which system call can be used to create device special files?
164. 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?
165. Which socket system call creates a Unix Domain Socket connection?
166. Which system call creates a named socket?
167. Which shell operator is used to send the standard output of the first command to the standard input of the second command?
168. Which C header needs to be included for socket programming?
169. Where are the DNS and search domains specified?
170. A process opens a file and forgets to close the file descriptor when it exits. What is the result?
171. If a write system call fails and if errno is set to EFAULT, what does it signify?
172. Which command can be used to install the native software package SOFTpkg on a Solaris system?
173. How do two threads synchronize access to shared data in a multi threaded application?
174. Which system call can be used to change process scheduling priority?
175. Which compiler option links the standard math library to the executable?
176. Which ones are true of typical Unix like systems?
177. Effect of appending an ampersand ('&') at the end of a shell command?
178. Placing a structure within another structure is called ____ structures.
179. _____ are the systems special characteristics that appeal to users.
180. An expert system uses _________ , or rules of thumb, to arrive at conclusions or make suggestions.