Skip to main content

Upwork/oDesk System Programming Test Answers

1. Which of the following system calls can be used to send a message via a connected socket?
 Answers: • send --- or --- • sendto ---- or ---- • sendmsg --- or ----- • write

 2. Which of the following methods can be used as a communication mechanism between two unrelated processes?
 Answers: • A pipe using the pipe system call. --- or ---- • A named pipe using the mknod system call. --- or ---- • Named sockets.
 

 3. Which of the following are true of Unix system calls?
 Answers: • The routine "malloc" which is used for allocating memory is a system call. --- or --- • A new file can be created using the "open" system call.

 4. Which of the following Linux commands can be used to identify the processes consuming maximum resources (CPU, Memory)?
 Answers: • ps --- or ---- • top

 5. Which of the following signals are used by the Unix shell to implement job control?
 Answers: • SIGSTOP --- or --- • SIGCONT

 6. Which of the following environment variables specifies the shared library search path?
 Answers: • SHLIB_PATH --- or ---- • LD_LIBRARY_PATH

 7. Which of the following statements are true?
 Answers: • "wc -l" can be used to count the number of lines in the input. --- or ---- • "find . -name '*.txt' -exec rm {} \;" removes all ".txt" files in the current directory hierarchy.

 8. Which of the following utilities would you use on a standard Linux system to debug a running application?
 Answers: • gdb. --- or ---- • strace.

 9. Which of the following can be used to inspect the system call arguments of a Linux process?
 Answers: • strace ---- or ---- • gdb

 10. Which of the following methods can be used to allocate and use memory on a Unix system?
 Answers: • malloc --- or ---- • calloc

 11. Which of the following utilities is used to generate a core file of a process on Linux?
 Answers: • gdb --- or --- • strace

 12. Which of the following can be used to debug the process "123" and program "test" on a Linux system?
 Answers: • gdb test 123 --- or --- • 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: • The process terminates without releasing the semaphore. --- or - • The semaphore is released if the process had specified SEM_UNDO during creation.

 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: • thread apply all bt

 15. Which of the following utilities is used to search out regular expressions in the input?
 Answers: • grep

 16. What does the command "mknod temp p" do?
 Answers: • It creates a named pipe.

 17. Threads created via pthread_create need to first set up shared memory
 using shmop before they can share data.
 Answers: • False

 18. What does the "open" system call return to the caller?
 Answers: • An integer greater than or equal to 0 on success and -1 on error.

 19. What is the effect of a process executing an unlink system call while another process has opened the same file?
 Answers: • The unlink system call will fail.

 20. Which of the following signals cannot be ignored by a process?
 Answers: • SIGKILL

 21. Ignoring the setup cost for each of the System V IPC mechanisms, which of the following is the most efficient?
 Answers: • System V, Shared Memory

 22. What command is used to list the shared libraries used by an executable?
 Answers: • ldd

 23. What does the following command do to the process with pid 12345?
 "kill -9 12345".
 Answers: • It sends the KILL signal causing the process to be killed.

 24. Which of the following system calls is the most memory efficient method of reading a file?
 Answers: • mmap

 25. Which of the following commands generates a listing of the system calls being executed by a program on Solaris?
 Answers: • truss

 26. What is the effect of issuing a "$c" command at the adb prompt during a debugging session on a Solaris 9 system?
 Answers: • It generates a listing of the stack trace.

 27. Which of the following sequences prints all the second column fields of an input file "values.txt"?
 Answers: • awk '{print $2}' values.txt

 28. Which of the following system calls increases the process priority?
 Answers: • nice

 29. Which of the following is true of Unix system calls?
 Answers: • System calls are executed in the kernel context.

 30. If a process is hung in the kernel context, sending it a SIGKILL will _____.
 Answers: • be delivered when the process switches back to the user context.

 31. The library routine printf does not use any system calls.
 Answers: • False.

 32. Which of the following gcc compiler options turns on optimization?
 Answers: • O

 33. 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: • g

 34. Which of the following options specifies a non standard library path during linking?
 Answers: • -L

 35. Which of the following shell operators redirects the standard input of the command being executed?
 Answers: • <

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

 37. Which of the following IPC message operations is performed to setup communication between arbitrary processes?
 Answers: • msgget

 38. What is the effect of executing the following system call on the file "test.txt"?
 open("test.txt", O_TRUNC)
 Answers: • If test.txt exists, the file is truncated to 0 bytes before returning.

 39. How does a programmer distinguish a child from its parent process following a fork system call?
 Answers: • The system call returns 0 to the child and the pid of the child to the parent.

 40. Which of the following libraries provides the POSIX thread implementation on Solaris?
 Answers: • libpthread

 41. Which of the following IPC shared memory sequences is correct?
 Answers: • shmget, shmat, shmdt

 42. How is the value of the shell environment variable IFS changed to comma (',')?
 Answers: • IFS=','; export IFS

 43. Which of the compiler options generates an assembler output file?
 Answers: • -S

 44. What does the '-pg' option of the Unix compiler do?
 Answers: • It turns on the profiling of the executable code.

 45. Shared libraries increase an application's disk size?
 Answers: • False.

 46. Which of the following redirects the standard error output of a command to the log file "error.log"?
 Answers: • "2>error.log"

 47. What are the typical system calls the Unix shell invokes when it
 has to execute a new command?
 Answers: • open, fork, exec.

 48. Which system call is used to send a signal to another process?
 Answers: • kill

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

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

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

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

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

 54. Which of the following commands can be used to list all the active TCP connections only on a Linux system?
 Answers: • netstat -t

 55. Which of the following ksh trap sequences causes the function 'handler' to be executed when the script exits?
 Answers: • 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: • 1023

 57. What is the effect of setting the "sticky" bit on an application's executable image?
 Answers: • 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: • cc -o domath domath.c -lm

 59. Which of the following sequences creates a socket based connection for communication?
 Answers: • socket, connect, listen, accept

 60. What does the open system call return upon success?
 Answers: • A positive integer which is the file descriptor.

 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: • The process is killed with a SIGSEGV.

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

 63. Which of the following shell parameters contains the return value of the previously executed shell command?
 Answers: • $?

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

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

 66. Which of the following commands can be used to list all the active TCP connections on a Linux system?
 Answers: • netstat -t

 67. What is the network byte order in Unix?
 Answers: • Big Endian

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

 69. How do threads created using pthread library share data between themselves efficiently?
 Answers: • They don't need any special mechanism as they share the data segment.

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

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

 72. What is the name of the standard linker on Unix?
 Answers: • ld

 73. Which of the following is employed by the operating system to speed up file IO on a Solaris system.
 Answers: • Buffer Cache

 74. How is the stack trace of all the threads in a multi threaded Linux application obtained?
 Answers: • "thread apply all backtrace" at the gdb prompt.

 75. Which of the following creates an IPC message channel?
 Answers: • id = msgget(key, 0700|IPC_CREAT);

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

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

 78. Which of the following system calls is specific to debugging?
 Answers: • ptrace

 79. Which of the following commands can be used to compile a C file called "test.c" into an executable called "test"?
 Answers: • cc -o test test.c

 80. Which of the following IO mechanisms allows greater performance to concurrent IO-intensive applications?
 Answers: • Memory Mapped IO

 81. What is the outcome of attempting an ioctl system call on a block device file?
 Answers: • The system returns ENXIO.

 82. Which of the following system calls can be used to create device special files?
 Answers: • 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: • core

 84. Which of the following socket system calls creates a Unix Domain Socket connection?
 Answers: • socket(PF_UNIX, SOCK_STREAM, protocol)

 85. Which of the following system calls creates a named socket?
 Answers: • 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: • |

 87. Which of the following C headers needs to be included for socket programming?
 Answers: • <sys/socket.h>

 88. Where are the DNS and search domains specified?
 Answers: • /etc/resolv.conf

 89. A process opens a file and forgets to close the file descriptor when it
 exits. What is the result?
 Answers: • 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: • The write buffer is not legal.

 91. Which of the following commands can be used to install the native software package SOFTpkg on a Solaris system?
 Answers: • pkgadd -d . SOFTpkg

Comments

  1. Welcome Bonus | Casino Poker Sites - Casino Poker Tournaments
    Casino Poker 토토 사이트 목록 is a very popular poker site in the US. There 카드 게임 종류 are many casinos out there that 무료슬롯머신 offer bet analysis the option of the bonus bet365 우회 주소 cash on a player

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Choose Best Digital Marketing Engineer for your Business ?

Digital Marketing is new marketing concept of products, services and others using digital technologies on the internet. Previously we know digital marketing interms of internet marketing or online marketing. Digital marketing campaign is run on all the platform like; Desktop, tablet, mobile etc. Digital Marketing functions are SEO(search engine optimization), SEM(search engine marketing), Content Marketing, campaign marketing, e-commerce marketing, SMM(social media marketing), SMO(social media optimization), E-mail marketing, display advertising, games, ASO(Apps store optimization), Bulk SMS, branding, reputation management and other digital marketing platform techniques. If we can talk about simple SEO executive role, PPC Analyst role, SMO expert role or other single task handler then its a single activity performer. But if we hire a digital marketing engineer then its necessary that he has knowledge and working ability of all above digital marketing techniques. Simply we

Top SEO Companies in India by TOPSEO's Ranking

I am providing you the list of top 10 SEO Companies/Firms/Agencies in India by TOPSEO's  (January 2016) 1. SEO.IN  Year Founded: 2002 Website: http://www.seo.in / 2. SEOValley Solutions Private Limited Year Founded: 2000 Website: http://www.seovalley.com / 3. PageTraffic Year Founded: 2002 Website: http://www.pagetraffic.com/ 4. SeoTonic Web Solutions Private Ltd. Year Founded: 2006 Website: http://www.seotonic.com/ 5. Outsource SEO Year Founded: 2004 Website: http://www.outsourceseo.com/ 6. Ranking By SEO Year Founded: 2008 Website: http://www.rankingbyseo.com/ 7. Techmagnate Year Founded: 2006 Website: http://www.techmagnate.com / 8. SEO Discovery Year Founded: 2006 Website: http://www.seodiscovery.com/ 9. Greenlemon Year Founded: 1999 Website: http://greenlemon.in/ 10. SEOXperts India Year Founded: 2008 Website: http://www.seoxpertsindia.com/

Vivo IPL(10) 2017 Schedule , Player List , Team And Venue Details

IPL (10) 2017 Schedule is yet to be announced by the governing council of the Indian premier League . As per the previous sessions of the IPL it might also schedule to start from April 2017 to May 2017 . This session of IPL will also known as the Vivo Ipl (10)2017 because Vivo Electronics got the title sponsorship to 2 year after Pepsi terminated the contract back in 2016 . Like last year former IPL champions Chennai Super Kings and Rajasthan Royal will not participate the the tournament till this year . As per the schedule set by the IPL Committee, the Indian Premier League 2017 would be starting from 3rd of April and continue till 26th of May 2017. The first match of IPL 10 will have the IPL 5 winner Kolkata Knight Riders battling against Delhi Daredevils. The inaugural match as well as the final match of the IPL season 10 championship scheduled for 26th of May would be hosted by Eden Gardens, the home ground for superstar Shah Rukh Khan owned Kolkata Knight Riders. There wou