MCQs > IT & Programming > System Programming MCQs > Basic System Programming MCQs

Basic System Programming MCQ

1. An expert system uses _________ , or rules of thumb, to arrive at conclusions or make suggestions.

Answer

Correct Answer: Heuristics

Note: This Question is unanswered, help us to find answer for this one

2. _____ are the systems special characteristics that appeal to users.

Answer

Correct Answer: Features

Note: This Question is unanswered, help us to find answer for this one

3. Placing a structure within another structure is called ____ structures.

Answer

Correct Answer: Nesting

Note: This Question is unanswered, help us to find answer for this one

4. What is the effect of appending an ampersand ("&") at the end of a shell command?

Answer

Correct Answer: It executes the command as a background job.

Note: This Question is unanswered, help us to find answer for this one

5. Which of the following are true of typical Unix like systems?

Answer

Correct Answer: Processes are more expensive to create than Threads.
Threads need Operating System parallelism support to exploit concurrency.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

6. Which of the following compiler options links the standard math library to the executable?

Answer

Correct Answer: -lm

Note: This Question is unanswered, help us to find answer for this one

7. Which of the following system calls can be used to change process scheduling priority?

Answer

Correct Answer: nice

Note: This Question is unanswered, help us to find answer for this one

8. How do two threads synchronize access to shared data in a multi threaded application?

Answer

Correct Answer: pthread_mutex_lock

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: pkgadd -d . SOFTpkg

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: The write buffer is not legal.

Note: This Question is unanswered, help us to find answer for this one

11.

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


Answer

Correct Answer:

The OS calls exit on behalf of the process before it terminates the process resulting in all the resources being reclaimed.      


Note: This Question is unanswered, help us to find answer for this one

12. Where are the DNS and search domains specified?

Answer

Correct Answer: /etc/resolv.conf

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer:

Note: This Question is unanswered, help us to find answer for this one

14. 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?

Answer

Correct Answer: |

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: bind

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: socket(PF_UNIX, SOCK_STREAM, protocol)

Note: This Question is unanswered, help us to find answer for this one

17. 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?

Answer

Correct Answer: core

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: mknod

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: The system returns ENOTTY.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Direct IO (Filesystem locking is skipped)

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: cc -o test test.c

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ptrace

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ar

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: stat

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: id = msgget(key, 0700|IPC_CREAT);

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Page Cache

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ld

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: 8192

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: SIGHUP

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: They don't need any special mechanism as they share the data segment.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: stack

Note: This Question is unanswered, help us to find answer for this one

32. What is the network byte order in Unix?

Answer

Correct Answer: Big Endian

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: -mshared

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: connect

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: $?

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

37.

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

      char    *cp = 0, c = *cp;


Answer

Correct Answer:

The process is killed with a SIGSEGV. 


Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: A positive integer which is the file descriptor.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: socket, connect, listen, accept

Note: This Question is unanswered, help us to find answer for this one

40.

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


Answer

Correct Answer:

cc -o domath domath.c -lm


Note: This Question is unanswered, help us to find answer for this one

41. What is the effect of setting the "sticky" bit on an application's executable image?

Answer

Correct Answer: It causes the system to load the program faster the next time it runs.

Note: This Question is unanswered, help us to find answer for this one

42.

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

  char buf[256]; 

   while (read(fd, buf, 256)) {

        /* Take some action */

  }

Answer

Correct Answer:

1023 


Note: This Question is unanswered, help us to find answer for this one

43. Which of the following ksh trap sequences causes the function "handler" to be executed when the script exits?

Answer

Correct Answer: trap handler EXIT

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: netstat -t

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ifconfig

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: kill -term 8977

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: 2

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ldd

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: trap

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: kill

Note: This Question is unanswered, help us to find answer for this one

51.

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


Answer

Correct Answer:

open, fork, exec. 


open, fork, exec. 


Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

52. Which of the following redirects the standard error output of a command to the log file "error.log"?

Answer

Correct Answer: error.log" ">

Note: This Question is unanswered, help us to find answer for this one

53. Shared libraries increase an application's disk size?

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

54. What does the "-pg" option of the Unix compiler do?

Answer

Correct Answer: It turns on the profiling of the executable code.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: -S

Note: This Question is unanswered, help us to find answer for this one

56. How is the value of the shell environment variable IFS changed to comma (',')?

Answer

Correct Answer: IFS=','; export IFS

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: shmget, shmat, shmdt

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: libpthread

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: The system call returns 0 to the child and the pid of the child to the parent.

Note: This Question is unanswered, help us to find answer for this one

60.

What is the effect of executing the following system call on the file "test.txt"?

open("test.txt", O_TRUNC)


Answer

Correct Answer:

If test.txt exists, the file is truncated to 0 bytes before returning.    


Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: msgget

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: perror

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: <

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: -L

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: g

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: O

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: be delivered when the process switches back to the user context.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: System calls are executed in the kernel context.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: nice

Note: This Question is unanswered, help us to find answer for this one

71. Which of the following sequences prints all the second column fields of an input file "values.txt"?

Answer

Correct Answer: awk '{print $2}' values.txt

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: It generates a listing of the stack trace.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: truss

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: mmap

Note: This Question is unanswered, help us to find answer for this one

75.

What does the following command do to the process with pid 12345?

"kill -9 12345".


Answer

Correct Answer:

It sends the KILL signal causing the process to be killed.


Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ldd

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: System V, Shared Memory

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: SIGKILL

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: The unlink system call will succeed.

Note: This Question is unanswered, help us to find answer for this one

80. What does the "open" system call return to the caller?

Answer

Correct Answer: An integer greater than or equal to 0 on success and -1 on error.

Note: This Question is unanswered, help us to find answer for this one

81.

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


Answer

Correct Answer:

False 


Note: This Question is unanswered, help us to find answer for this one

82. What does the command "mknod temp p" do?

Answer

Correct Answer: It creates a named pipe.

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: grep

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: The process terminates without releasing the semaphore.
The semaphore is released if the process had specified SEM_UNDO during creation.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: gdb test 123
strace -f -p 123

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: gdb
gcore

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: calloc

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: strace
gdb

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: gdb
ltrace
strace
ptrace

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: SHLIB_PATH
LD_LIBRARY_PATH
B.C

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: SIGSTOP
SIGCONT
B.C

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: ps
top
A.B

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Signals

Note: This Question is unanswered, help us to find answer for this one

94.

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?

Answer

Correct Answer: thread apply all bt

Note: This Question is unanswered, help us to find answer for this one

95.

Which of the following are true of Unix system calls?

Answer

Correct Answer: The routine "malloc" which is used for allocating memory is a system call.

Note: This Question is unanswered, help us to find answer for this one

96.

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

Answer

Correct Answer: send

Note: This Question is unanswered, help us to find answer for this one

97. What does this code do: BOOL sharedLockSuccess = NO; NSLock *aMutex; : sharedLockSuccess = [aMutex lockWhenCondition:1 beforeDate:[NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval)3600]]; :

Answer

Correct Answer: A mutex is tried to be locked within a specific time

Note: This Question is unanswered, help us to find answer for this one

98. 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?

Answer

Correct Answer: Compiler-Dynamic Linker incompatibility

Note: This Question is unanswered, help us to find answer for this one

99. 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?

Answer

Correct Answer: The behavior of mkdir() is undefined if anything other than permission bits is set

Note: This Question is unanswered, help us to find answer for this one

100. In a Unix toolchain, which one of these pairs does not fit with the others?

Answer

Correct Answer: Executable and compiler

Note: This Question is unanswered, help us to find answer for this one

101. What does this code do: [aLock lockWhenCondition:(int)self beforeDate:[NSDate dateWithTimeIntervalSinceNow:maxTimeInterval]];

Answer

Correct Answer: Control blocks for some time on a lock on a condition that is unique to an instance

Note: This Question is unanswered, help us to find answer for this one

102. Which of the following could the fork() command return to the parent process?

Answer

Correct Answer: 4066

Note: This Question is unanswered, help us to find answer for this one

103. 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?

Answer

Correct Answer: The parent must close pipe_fd[0], and the child must close pipe_fd[1]

Note: This Question is unanswered, help us to find answer for this one

104. 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 */ :

Answer

Correct Answer: Replace the declaration with: int file1;

Note: This Question is unanswered, help us to find answer for this one

105. Which one of the folloing is NOT necessary for a basic CORBA system?

Answer

Correct Answer: CORBAfacilities

Note: This Question is unanswered, help us to find answer for this one

106. In order to create a counting mutex, which mode does it need to use?

Answer

Correct Answer: PTHREAD_MUTEX_RECURSIVE

Note: This Question is unanswered, help us to find answer for this one

107. 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?

Answer

Correct Answer: S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH

Note: This Question is unanswered, help us to find answer for this one

108. Yousee the following function call in some code: pthread_setspecific(key, value); What will this allow the coder to do?

Answer

Correct Answer: Access thread-specific data outside the thread

Note: This Question is unanswered, help us to find answer for this one

109. 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:

Answer

Correct Answer: may use either thread-id or port number

Note: This Question is unanswered, help us to find answer for this one

110. Which of the following functions sends a signal to the executing process?

Answer

Correct Answer: raise()

Note: This Question is unanswered, help us to find answer for this one

111. How can two processes communicate despite having firewalls between them?

Answer

Correct Answer: SOCKS

Note: This Question is unanswered, help us to find answer for this one

112. An Internet socket connection essentially is:

Answer

Correct Answer: Two host addresses and two port numbers

Note: This Question is unanswered, help us to find answer for this one

113. The result of calling kill(6003, 0) is which of the following?

Answer

Correct Answer: The existence of process 6003 is checked

Note: This Question is unanswered, help us to find answer for this one

114. Wha does the following line do? unsigned transOK : 1;

Answer

Correct Answer: Identifies a bit in a byte to use as a flag

Note: This Question is unanswered, help us to find answer for this one

115. 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?

Answer

Correct Answer: The second 4KB of the file will be loaded into a 4KB memory location

Note: This Question is unanswered, help us to find answer for this one

116. Which of the following techniques can help keep system programs secure?

Answer

Correct Answer: Check all system calls for error conditions

Note: This Question is unanswered, help us to find answer for this one

117. In gdb before using 'jump' you would typically do which one of the following:

Answer

Correct Answer: Set a breakpoint

Note: This Question is unanswered, help us to find answer for this one

118. In a Publish-And-Subscribe implementation, a subscriber must:

Answer

Correct Answer: Know the event name or event identifier for one or more events

Note: This Question is unanswered, help us to find answer for this one

119. 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?

Answer

Correct Answer: sock_struct passed by reference

Note: This Question is unanswered, help us to find answer for this one

120. A 'crashed' software needs to be debugged using its core dump. You would start by doing:

Answer

Correct Answer: attach

Note: This Question is unanswered, help us to find answer for this one

121. What is the purpose of a semaphore?

Answer

Correct Answer: To protect a critical section of code

Note: This Question is unanswered, help us to find answer for this one

122. 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); }

Answer

Correct Answer: Re-entrantly tokenizes on delimiter " ” to stringify something

Note: This Question is unanswered, help us to find answer for this one

123. 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

Answer

Correct Answer: It is neither 'code' nor will the compiler 'see' it

Note: This Question is unanswered, help us to find answer for this one

124. Which of the following advocates the use of memmove() over memcopy() for performing fast data copying from one buffer to another correctly?

Answer

Correct Answer: The buffers may overlap

Note: This Question is unanswered, help us to find answer for this one

125. CORBA's DII allows a client to do which one of the following?

Answer

Correct Answer: Discover new objects and interfaces at runtime

Note: This Question is unanswered, help us to find answer for this one

126. Sharing memory between processes using mmap vs. shm_open has which of the following advantages?

Answer

Correct Answer: The memory buffer is destroyed when the processes end

Note: This Question is unanswered, help us to find answer for this one

127. Which of the following is the result of a process calling UNIX exec()?

Answer

Correct Answer: The process is completely overwritten

Note: This Question is unanswered, help us to find answer for this one

128. In an IDL which one of the following is NOT a valid declaration?

Answer

Correct Answer: oneread

Note: This Question is unanswered, help us to find answer for this one

129. You want to copy binary contents of memory from one location to another. Which one of these h-files will you #include?

Answer

Correct Answer: string.h

Note: This Question is unanswered, help us to find answer for this one

130. A thread has its own copy of which of th following?

Answer

Correct Answer: Stack

Note: This Question is unanswered, help us to find answer for this one

131. Which one is not a difference between exit() and _exit()?

Answer

Correct Answer: One is for the main process; the other for forked processes

Note: This Question is unanswered, help us to find answer for this one

132. In order to prevent signal handler race conditions, a developer must do which of the following?

Answer

Correct Answer: Call sigaction() to block the signal and set the signal mask at the same time

Note: This Question is unanswered, help us to find answer for this one

133. What is a UNIX directory?

Answer

Correct Answer: A file that contains other files

Note: This Question is unanswered, help us to find answer for this one

134. 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:

Answer

Correct Answer: sched_yield()

Note: This Question is unanswered, help us to find answer for this one

135. What type of attack can be mitigated by using ulimit, setrlimit(), and quotactrl()?

Answer

Correct Answer: Denial of service

Note: This Question is unanswered, help us to find answer for this one

136. What does the line #define S_IRWXG 0000070 relate to?

Answer

Correct Answer: Flags for file access

Note: This Question is unanswered, help us to find answer for this one

137. You want a char * that will contain the timestamp as YYYYMMDD-hh:mm:ss . You would use:

Answer

Correct Answer: strftime()

Note: This Question is unanswered, help us to find answer for this one

138. Which of the following is an advantage of using pipes over shared memory for interprocess communication?

Answer

Correct Answer: No additional work required on multiple CPU systems without cache coherence

Note: This Question is unanswered, help us to find answer for this one

139. 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?

Answer

Correct Answer: It isn't possible to tell without looking at my_print_func()

Note: This Question is unanswered, help us to find answer for this one

140. When there are more fork() calls than wait() calls, which of the following is created?

Answer

Correct Answer: zombie

Note: This Question is unanswered, help us to find answer for this one

141. Which of the following can be called to remove zombie processes?

Answer

Correct Answer: wait4()

Note: This Question is unanswered, help us to find answer for this one

142. Thread joining synchronizes threads by doing which of the following?

Answer

Correct Answer: The thread that calls join blocks until all of the joinable threads complete

Note: This Question is unanswered, help us to find answer for this one

143. 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;

Answer

Correct Answer: The present object's ultimate superclass or base class below the root object

Note: This Question is unanswered, help us to find answer for this one

144. In UNIX, a program requires higher privileges in order to do which of the following?

Answer

Correct Answer: Listen on a port below 1024

Note: This Question is unanswered, help us to find answer for this one

145. Which of the following could the fork() command return to the child process?

Answer

Correct Answer: 0

Note: This Question is unanswered, help us to find answer for this one

146. Given: int s, l; struct sockaddr_un sock_struct; Choose the option that corrects the following line: bind(s, sock_struct, l);

Answer

Correct Answer: bind(s, &sock_struct, l);

Note: This Question is unanswered, help us to find answer for this one

147. 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?

Answer

Correct Answer: Big endian versus littlen endian

Note: This Question is unanswered, help us to find answer for this one

148. Which of the following best describes the purpose of the unlink() call?

Answer

Correct Answer: Removes the file from its directory

Note: This Question is unanswered, help us to find answer for this one

149. Thrashing caused by loading a large file can be reduced by mapping the file to memory due to which of the following features?

Answer

Correct Answer: Mapped memory uses lazy loading

Note: This Question is unanswered, help us to find answer for this one

150. 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 */ : }

Answer

Correct Answer: line 21: if (my_sock < 0) {

Note: This Question is unanswered, help us to find answer for this one

151. Which of the following IPC mechanisms has an inode?

Answer

Correct Answer: named pipe

Note: This Question is unanswered, help us to find answer for this one

152. Any code that calls a function whose interface includes the line raises(aLibrary:BookIsMissing); should do which one?

Answer

Correct Answer: Implement an exception handler

Note: This Question is unanswered, help us to find answer for this one

153. 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?

Answer

Correct Answer: Standard file access functions

Note: This Question is unanswered, help us to find answer for this one

154. Which of the following provides the most random seed source for a pseudo random number generator?

Answer

Correct Answer: /dev/random

Note: This Question is unanswered, help us to find answer for this one

155. When a new process is created using fork(), which of the following describes the state of open file descriptors?

Answer

Correct Answer: The child inherits the parent’s

Note: This Question is unanswered, help us to find answer for this one

156. Which of the following is correct for the standard file descriptors that are automatically opened in UNIX?

Answer

Correct Answer: STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2

Note: This Question is unanswered, help us to find answer for this one

157. The sticky bit is used to enable which of the following features?

Answer

Correct Answer: Prevent users from renaming or deleting files created by other users

Note: This Question is unanswered, help us to find answer for this one

158. Which of the following fields in the stat struct contain last time the file was modified?

Answer

Correct Answer: st_mtime

Note: This Question is unanswered, help us to find answer for this one

159. What is thread safety?

Answer

Correct Answer: Multiple threads can be executed without corrupting shared data

Note: This Question is unanswered, help us to find answer for this one

160. 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; }

Answer

Correct Answer: No, because both stack depth and stack-frame size are unpredictable

Note: This Question is unanswered, help us to find answer for this one

161. If you see: int ff; write(ff, data, sizeof(data)); you know that ff is:

Answer

Correct Answer: a file descriptor

Note: This Question is unanswered, help us to find answer for this one

162. The purpose of the poll() and select() system calls is to perform which of the following functions?

Answer

Correct Answer: Watch a set of file descriptors to see which are ready

Note: This Question is unanswered, help us to find answer for this one

163. Given the following line: my_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_APPEND, 0644); Which statement is true?

Answer

Correct Answer: Opens a file descriptor, bitwise OR'ing output flags and in mode 644

Note: This Question is unanswered, help us to find answer for this one

164. Which of the following is true of hard links?

Answer

Correct Answer: Hard links are directory entries that point to the same inode as another file

Note: This Question is unanswered, help us to find answer for this one

165. If a function is a 'blocking function' then:

Answer

Correct Answer: The function must terminate before control returns to caller

Note: This Question is unanswered, help us to find answer for this one

166. Threads and processes are related in which one of the following ways?

Answer

Correct Answer: Each thread exists within a process

Note: This Question is unanswered, help us to find answer for this one

167. You want the same codebase to conditionally compile on and for different target platforms. Which of the following would you use?

Answer

Correct Answer: #itdef, #ifndef, and #endif

Note: This Question is unanswered, help us to find answer for this one

168. The language of choice for Systems Programming is:

Answer

Correct Answer: None of these

Note: This Question is unanswered, help us to find answer for this one

169. An orphan process occurs as a result of which of the following conditions?

Answer

Correct Answer: Parent process terminates before its child process

Note: This Question is unanswered, help us to find answer for this one

170. Using strncpy() to copy strings can help prevent which of the following attacks?

Answer

Correct Answer: Buffer overflow

Note: This Question is unanswered, help us to find answer for this one

171. You want to listen on a port for some user-defined data stream. Would you use port 80?

Answer

Correct Answer: No, it is a 'well-defined' or reserved port.

Note: This Question is unanswered, help us to find answer for this one

172. 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?

Answer

Correct Answer: fflush()

Note: This Question is unanswered, help us to find answer for this one

173. Race conditions are caused by which of the following conditions in a multithreaded system?

Answer

Correct Answer: Proper program function is dependent on the execution sequence and timing of each thread

Note: This Question is unanswered, help us to find answer for this one

174. You see the line: listen (s, 3); You are looking at code for:

Answer

Correct Answer: A server's socket

Note: This Question is unanswered, help us to find answer for this one

175. Using a terminal you want to log in to an account on a remote computer and securely build. Which would you use?

Answer

Correct Answer: SSH

Note: This Question is unanswered, help us to find answer for this one

176. When communicating across sockets, which of the following functions must be used when the socket is in a connected state?

Answer

Correct Answer: send()

Note: This Question is unanswered, help us to find answer for this one

177. Which one of the following is NOT applicable in real-time Systems Programming?

Answer

Correct Answer: E-R Schema

Note: This Question is unanswered, help us to find answer for this one

178. What does the following line do? memset((char *)&ctl_addr, 0, sizeof(ctl_addr));

Answer

Correct Answer: Initializes the region of memory pointed to by &ctl_addr

Note: This Question is unanswered, help us to find answer for this one

179. Where would you expect to encounter the following code? for (i=1; i<argc; i++) { if (argv[i][0] == '-') {

Answer

Correct Answer: In the beginning of the main() function

Note: This Question is unanswered, help us to find answer for this one