1) Sequential Model of programming is a kind of model in which _________.
(A) Only I is true
(B) Only II is true
(C) Both I & II is true
(D) Neither I nor II is true
2) In _______ model the computer programs are set up in almost story form
(A) Parallel processing model
(B) Sequential Processing Model
(C) Distributed Processing Model
(D) None of these
3) The concurrency challenge faced by the developer is__________
(A) Identifying the relationship between concurrently executing task
(B) Communicating between two or more task that are executing in parallel
(C) Decomposing software into instructions or set of task that are executed simultaneously
(D) All of these
4) Concurrent task execute in_________.
(A) Single Processing Environment
(B) Multiprocessing Environment
(C) Both a and b
(D) None of these
5) For executing multiple tasks the context switching is more prominently used in_________.
(A) Single Processing Environment
(B) Multiprocessing Environment
(C) Both a and b
(D) None of these
6) In the following software development methodology there is interaction with the client at each phase
(A) Waterfall
(B) Structured
(C) Rapid Prototyping
(D) None of these
7) In the following software development methodology Each phase must be completed entirely before
entering to the next phase
(A) Waterfall
(B) Structured
(C) Rapid Prototyping
(D) None of these
8) In the following software development methodology top down approach to software development is
adopted
(A) Waterfall
(B) Structured
(C) Rapid Prototyping
(D) None of these
9) In the following software development methodology risk analysis and verification is of prime
importance
(A) Waterfall
(B) Structured
(C) Rapid Prototyping
(D) None of these
10) The hardware mechanism that enables a device to notify the CPU is called______________
(A) Polling
(B) System Call
(C) Interrupt
(D) None of these
11) Process is ______________.
(A) Program in execution
(B) An instance of program running on a computer
(C) The entity that can be assigned to or can be executed
(D) All of these
12) In software decomposition technique WBS means__________.
(A) Work Breakdown Structure
(B) Work Binding Structure
(C) Work Breaking Structure
(D) None of these
13) In software decomposition technique AA means
(A) Algorithmic Analysis
(B) Architectural Analysis
(C) Architectural Artifacts
(D) Analytical Artifacts
14) Which of the following is said to be object oriented programming paradigm?
(A) C++
(B) Eiffel
(C) Small Talk
(D) All of these
15) Interprocess Communication ( IPC) _______.
(A) allows processes to communicate and synchronize their action using same address space
(B) allows processes to communicate and synchronize their actions using the separate address space
(C) allows the processes to only synchronizetheir action without communication
(D) None of these
16) An IPC provides the facility of _______.
(A) read and write messages
(B) send and receive messages
(C) delete and modify messages
(D) None of these
17) Interprocess communication is ______.
(A) Communication within the processes
(B) Communication between two processes
(C) Communication between two threads of the same process
(D) None of these
18) Inter-process communication can be done through________
(A) System calls
(B) Mails
(C) Messages
(D) None of these
19) Message that can be sent by a process___________.
(A) must be of fixed size
(B) must be of varialbe size
(C) can be of fixed or variable size
(D) None of these
20) Inter-process communication can be done through________
(A) Message Link
(B) Communication Link
(C) Data Link
(D) All of these
21) ___________is a bidirectional communication link that utilizes port and IP address.
(A) Seamaphore
(B) shared memory
(C) Socket
(D) Message queue
22) What do you understand by the term reusable resource?
(A) the resource that can be used by one process at a time and is not depleted by that use
(B) the resource that can be shared by multiple threads
(C) the resource that can be used by more than one process at a time
(D) None of these
23) the resource that can be used by more than one process at a time
(A) Data race
(B) Deadlock
(C) Indefinite postponement
(D) All of these
24) Data race condition is a condition in which______.
(A) one chunk of data is immediately followed by another chunk of data
(B) when two or more tasks are attempting to update the same data source at the same time
(C) one resource is used by two or more process immediately one after the other
(D) None of these
25) A set of processes is deadlock______.
(A) A set of processes is deadlock______.
(B) when all the processes are trying to kill each other
(C) when each process is blocked forever due to unavailabilty of resources
(D) All of these
26) when each process is blocked forever due to unavailabilty of resources
(A) Mutual Exclusion
(B) resource can not be available as some process is alrady holding it
(C) resource can not be available as some process is alrady holding it
(D) All of these
27) Opertaing system checks for deadlock condition_____.
(A) every time a resource request is made
(B) at fixed time interval
(C) Both a and b
(D) None of these
28) To avoid deadlock ___________________.
(A) there must be fixed and adequate number of resource available
(B) allocation of resourse must be done only onece
(C) allocation of resourse must be done only onece
(D) None of these
29) Records, files,shared memory,program variables ara called___________________ .
(A) Software Resources
(B) Hardware Resources
(C) Hybrid Resources
(D) Can not be the resources.
30) Printer , modem and multimedia devices are called as _____________.
(A) Software Resources
(B) Hardware Resources
(C) Hybrid Resources
(D) Can not be the resources.
31) Which of the following is a synchronizing relationship _______.
(A) start to start
(B) finish to start
(C) Both a and b
(D) None of these
32) The synchronization relationship in which task A can not be start until task B called ______________.
(A) start to start
(B) finish to start
(C) start to fininsh
(D) finish to finish
33) The synchronization relationship in which task B can not start until Task A finishes is called_______.
(A) start to start
(B) finish to start
(C) start to fininsh
(D) finish to finish
34) The synchronization relationnship in which task Acan not start until Task B finishes is called ________.
(A) start to start
(B) finish to start
(C) start to fininsh
(D) finish to finish
35) The synchronization relationnship in which task Acan finish until Task B finishes is called ________.
(A) start to start
(B) finish to start
(C) start to fininsh
(D) finish to finish
36) The behavioral modeling of multiprocessing componants can be repreented by following UML
diagram.
(A) component diagram.
(B) deployment diagram.
(C) state diagram
(D) None of these
37) The POSIX stand for _________.
(A) post operating system interface extention
(B) portable operting system inter process comunication
(C) programmable operting system interaction
(D) programmable operting system interaction
38) Operating system means________________.
(A) the set of programs that allows the programmer to write his source code.
(B) the set of program that control the working of computer.
(C) the set of program that help in executing an application program.
(D) the set of program that help in finding the error inan application program.
39) The Operating system role is demostrated by_____________.
(A) Software Resources
(B) Resource management
(C) Both a and b
(D) None of these
40) During the interaction of developers with operating system, the actual operating calls and IPC are at
___________ .
(A) level 1
(B) level 2
(C) level 3
(D) level 4
41) During the interaction of developers with operating system,the application framework for parallel
programming is at ___________________.
(A) level 1
(B) level 2
(C) level 3
(D) level 4
42) During the interaction of developers with operating system, the class libraries and OO components
for multiprocessing are at _____________.
(A) level 1
(B) level 2
(C) level 3
(D) level 4
43) During the interaction of developers with operating system, the posix spawn and thread
functionalities at ______________ .
(A) level 1
(B) level 2
(C) level 3
(D) level 4
44) The Operating system core services include ___________.
(A) Process and memory management
(B) I/O management
(C) File system Management
(D) All of these
45) Process management function of operating system kernel includes ________________ .
(A) Process creation and termination
(B) process scheduling and dispatching
(C) process switching
(D) All of these
46) Standard set of functions through which interacts with kernel is defined by __________ .
(A) kernel code
(B) compiler
(C) system libraries
(D) None of these
47) Using C++ the task can be implemented using _________ .
(A) process
(B) thread
(C) combination of process and thread
(D) None of these
48) For creating a new operation system process_____________ is used.
(A) posix_spawn()
(B) posix_create()
(C) create_process()
(D) new()
49) For controlling each process _____________ .
(A) Scheduling policy is used
(B) priority for each process is useful
(C) Both a and b
(D) None of these
50) Child processes obtained from-------are always standard .
(A) posix_spawn()
(B) pthread_create()
(C) create()
(D) Both a and b
51) The process that calls posix_spawn() is called ____________.
(A) parent process
(B) child process
(C) can be parent or child
(D) neither parent nor child
52) Correct instrucion for exiction of the threaded [Link] program is ______________.
(A) g++ -o output [Link] -thread
(B) g++ -o output [Link] -lthread
(C) g++ -o output [Link] -lpthread
(D) None of these
53) Which feature of C++ help to adopt decarative approach to parallel programming?
(A) Abstraction
(B) Generic programming or use of templates
(C) Inheritance
(D) Polymorphism
54) Interface classes _____________ .
(A) makes the data accessible to any outside class
(B) makes the data accessible to any outside class
(C) provide wrapper for function, data or other classes
(D) none of these
55) Interface class is also called as ____________ .
(A) Derived class
(B) Adaptor Class
(C) Base class
(D) None of these
56) Interface classes _____________ .
(A) provide wrapper for function data and other classes
(B) if used along with posix ,then cross platform components can be built
(C) can be used to add own building blocks to hogh level libraries
(D) All of these
57) A process is _______________ .
(A) same as program.
(B) normally built with computer hardware
(C) a sequential program in execution
(D) None of these
58) The CMP stands for
(A) Compact Multiprocessor
(B) Compact Multi-programmer
(C) Chip Multiprocessor
(D) None of these
59) The aim of multiprogramming is to
(A) minimize CPU utilization
(B) maximize CPU utilization
(C) to have multiple processes in ready state
(D) none of these
60) In operating system, each process has its own__________________.
(A) Adress space
(B) open files
(C) signal handler and global variables
(D) All of these
61) For creating the process _______ function is used.
(A) fork-exec()
(B) new
(C) create
(D) All of these
62) If a child process is created using posix_spawn() then child inherits__________from parent process.
(A) Scheduling policy
(B) process group id
(C) file descriptor
(D) All of these
63) On success,the posix_spawn() function contains pid which is actually_________.
(A) pid of parent process
(B) pid of child process
(C) pid of the program in which posix_spawn() is called
(D) pid of the program in which posix_spawn() is called
64) The processes that execute system code are called________.
(A) user porcesses
(B) kernel processes
(C) parent processes
(D) child processes
65) The processes that execute their own code or sometimes make system function call are
called________.
(A) user porcesses
(B) kernel processes
(C) parent processes
(D) child processes
66) The processes that perform housekeeping tasks such as allocating memory,checking device and so
on are called_________.
(A) user porcesses
(B) kernel processes
(C) parent processes
(D) child processes
67) Process control block is_______.
(A) a block in memory
(B) process type varialbe
(C) data structure
(D) secondary storage
68) A process stack does not contain __________.
(A) local variables
(B) function parameters
(C) return addresses
(D) PID of cild process
69) The address of next instruction to be executed by current process is provided by_______.
(A) CPU register
(B) program stack
(C) program counter
(D) None of these
70) The program code lies in______.
(A) stack segement
(B) data segment
(C) text segment
(D) process control block
71) The stack segment grows_______.
(A) downward towards the data segment
(B) downward towards the text segment
(C) upward towards the PCB
(D) can not grow, it has fixed size
72) The PCB stands for ___________ .
(A) Process control block
(B) program control block
(C) process communication block
(D) None of these
73) Kernel keeps track of state of each task by using the data structure called________.
(A) Process control block
(B) user control block
(C) stack
(D) queue
74) The information such as content of user,control and status register, stack pointers is stored
in_______section of PCB.
(A) process identification
(B) process state information
(C) process control information
(D) None of these
75) The process control block does not contain _______.
(A) process identification
(B) process state information
(C) process control information
(D) bootstrap program
76) The entry of all PCB's of current processes is in _________.
(A) process table
(B) process register
(C) secondary memory
(D) None of these
77) A single thread allows a process to performs ____________.
(A) one task at a time
(B) capacity
(C) execution
(D) throughout
78) The number of processes completed per unit time is known as _______________________ .
(A) output
(B) capacity
(C) execution
(D) throughout
79) The child process completes execution but the parent keeps executing,then the child process is in
following state ________________.
(A) dead
(B) orphan
(C) zombie
(D) running
80) Process state is a part of __________________.
(A) Process control block
(B) file allocation table
(C) inode
(D) None of these
81) Virtual memory is _____________________ .
(A) large main memory
(B) large secondary memory
(C) an illusion of large main memory
(D) None of these
82) The sleeping is a state which _______________.
(A) can not continue to execute as it is waiting for an evnet to occur
(B) present in ready queue
(C) is signaled as stop
(D) None of these
83) Process in ready queue are _____________.
(A) Running process
(B) Runnable process
(C) Zombied process
(D) None of these
84) The state of the process after which it encounters wait on event or I/O is __________________.
(A) running
(B) ready
(C) sleeping
(D) stopped
85) Switching the CPU to another process requires to save state of the old process and loading new
process state is called as ______________ .
(A) time sharing
(B) process blocking
(C) context switching
(D) None of these
86) ________________ performs the job of allocating a process to the processor.
(A) Long term scheduler
(B) short term scheduler
(C) dispatcher
(D) interrupt
87) In UNIX,following is an utility command for displaying the currently executing processes
___________.
(A) ls
(B) ps
(C) nice
(D) man
88) Context switch occurs when __________________.
(A) process is preempted
(B) process voluntarily gives up the processor
(C) process makes an I/o request or process switches from user mode to kernel mode
(D) all of the above cases
89) Context switch changes the process mode from ______________.
(A) user mode to kernel mode
(B) kernel mode to user mode
(C) kernel mode to kernel process
(D) Both a and b
90) Each process is identified by ___________ .
(A) PCB
(B) process indetifier
(C) device queue
(D) process stack
91) A parent process calling------system call will be suspended until children processes terminate.
(A) fork
(B) wait
(C) exec
(D) exit
92) Which of the following system call does not return control to the calling point,on termination?
(A) fork
(B) exec
(C) Both a and b
(D) none of these
93) Which of the following system calls transforms executable binary file into a process?
(A) fork
(B) exec
(C) ioctl
(D) none of these
94) Following is a function that returns two values if it succeeds ______________.
(A) fork
(B) exec
(C) ioctl
(D) none of these
95) Which function establishes the connection between a process and a message queue with a message
queue descriptor?
(A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
96) Which function removes the association between the message queue descriptor and its message
queue?
(A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
97) Which function adds the message pointed to the message queue specified?
(A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
98) Which function receives the oldest of the highest priority message(s) from the message queue
specified? (A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
99) Which function registers the calling process to be notified of a message arriving at an empty
message queue that is associated with the specified message queue descriptor?
(A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
100) Which function obtains the status information and attributes of the message queue and the open
message queue description associated with the message queue descriptor?
(A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
101) Which function sets the status information and attributes of the message queue?
(A) mq _open()
(B) mq _close()
(C) mq _send()
(D) mq _receive()
102) What is the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using
[Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;bord
er:solid gray;border-width:.1em .1em .1em
.8em;padding:.2em .6em;"><pre style="margin: 0; line-
height: 125%"><span style="color: #4c8317">#include
<stdio.h></span>
<span style="color: #4c8317">#include
<stdlib.h></span>
<span style="color: #4c8317">#include
<pthread.h></span>
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr );
main()
pthread_t thread1;
<span style="color: #00aaaa">char</span> *message1 =
<span style="color: #aa5500">"Thread-2"</span>;
message1 = <span style="color:
#aa5500">"Thread-1"</span>;
<span style="color: #00aaaa">int</span> iret2;
iret2 = pthread_create( &thread2, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message1);
pthread_join( thread1, <span style="color:
#00aaaa">NULL</span>);
exit(<span style="color: #009999">0</span>);
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr )
<span style="color: #00aaaa">char</span> *message;
message = (<span style="color: #00aaaa">char</span>
*) ptr;
printf(<span style="color: #aa5500">"%s
"</span>, message);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using
[Link] -->
(A) Thread-2
(B) Thread-1
(C) Error
(D) None
103) WBS typically reflects _______ decomposition while AA reflects ________ decomposition.
(A) Object oriented, procedural
(B) Procedural, object oriented
(C) procedural, algorithm
(D) object oriented, distibuted
104) Which of the following is the POSIX mechanism used for inter-process communication?
(A) POSIX message queues
(B) shared memory
(C) pipes
(D) All of these
105) Among the following which is the real challenge of IPC mechanism?
(A) Among the following which is the real challenge of IPC mechanism?
(B) releasing and locking up the proper data source
(C) having proper file permission for use
(D) All of these
106) The UML dig that represent the run time configuration of processing node hardware and software
componant in system is called_______.
(A) component diagram.
(B) deployment diagram.
(C) class diagram.
(D) None of these
107) For establishing the connection between a process and a message queue,following function is used
____________ .
(A) mq_notify()
(B) mq_open()
(C) mq_create()
(D) mq_start()
108) For obtaning the status information and attributes of message queue, following function is used
__________ .
(A) mq_notify()
(B) mq_setattr()
(C) mq_getattr()
(D) mq_receive()
109) _________________ operating system API is used to associate software task with thread.
(A) create_thread()
(B) attach_thread()
(C) pthread_create()
(D) All of these
110) Select the scheduling policy suppored by POSIX standard ____________ .
(A) SCHED_FIFO
(B) SCHED_RR
(C) SCHED_SPORADIC
(D) All of these
111) On success, the posix_spwan() function returns______.
(A) 0
(B) -1
(C) 1
(D) -2
112) The process image is formed using___________.
(A) PCB and stack segment
(B) data segment
(C) text segment
(D) All of these
113) The information such as current state, priority of process,pointers to parent/child PCB is stored in
_________ section of PCB.
(A) process identification
(B) process state information
(C) process control information
(D) None of these
114) The information such as process id and parent process id is stored in ____________ section of PCB.
(A) process identification
(B) process state information
(C) process control information
(D) None of these
115) The typical element of process image are _________.
[Link] data [Link] data
3. user program [Link] stack
(A) 1,2,3
(B) 2,3,4
(C) 1,2,4
(D) All of these
116) The degree of multiprogramming is _______.
(A) the number of processes in ready state
(B) the number of processes in memory
(C) the number of processes executing per unit time
(D) None of these
117) Which of the following transition is not possible?
(A) stopped to ready
(B) ready to running
(C) running to sleeping
(D) sleeping to running
118) If the primary requirement is to provide good response time and share the resources equitably
then the scheduling algorithm that can be applied is ___________ .
(A) FIFO
(B) Round Robin
(C) Priority based preemtive Scheduling
(D) SJF
119) With ___________________ more than one process can be running simultaneously each on a
different processor whereas with ________________ only one process can execute at a time.
(A) mulitiprocessing, multiprogramming
(B) Multiprogramming, uniprogamming
(C) uniprogramming, multiprogramming
(D) Multiple OS, Multithreading
120) Using ps utility for full listing of the processes following command is issued _____________.
(A) ls -f
(B) ls -full
(C) ls -j
(D) ls -o
121) The return value for the fork system call is------for child process and------for parent process.
(A) non zero integer,zero
(B) zero,negative integer
(C) zero,non zero integer
(D) None of these
122) What will be the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using [Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em
.1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color:
#008080">#include<iostream></span>
<span style="color: #000080; font-weight: bold">using</span> <span style="color: #000080; font-
weight: bold">namespace</span> std;
<span style="color: #000080; font-weight: bold">int</span> main()
fork();
cout<<<span style="color: #0000FF">"\n Hello"</span>;
cout<<endl;
<span style="color: #000080; font-weight: bold">return</span> <span style="color:
#0000FF">0</span>;
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using [Link] -->
(A) It will display Hello once
(B) It will be display Hello twice
(C) It will not display Hello
(D) Syntax Error
123) EREW policy is solution to _________ problem
(A) deadlock
(B) data race
(C) Indefinite postponement
(D) All of these
124) ________ model is best suitable for data parallelism.
(A) SISD
(B) SIMD
(C) MISD
(D) None of these
125) In the following snippet, the statement containing 'printf()' is executed _________ number of
times.
<!-- HTML generated at Sahil's Blog [Link] using [Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em
.1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%">fork();
fork();
printf(<span style="color: #0000FF">"\n I am Process : %d"</span>,getpid());
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using [Link] -->
(A) 2
(B) 6
(C) 4
(D) 8
126) On executing the following statement in an unprivileged mode, the kill() function returns
___________.
<!-- HTML generated at Sahil's Blog [Link] using [Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em
.1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color:
#000080; font-weight: bold">int</span> ret=kill(<span style="color: #0000FF">1</span>,<span
style="color: #0000FF">5</span>);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using [Link] -->
(A) -1
(B) 0
(C) 1
(D) Any positive integer
127) Suppose a process makes call to getppid() function and the function returns the value '3798' , then
this number indicates
(A) process-id of calling process
(B) process=id of child process of the calling process
(C) process-id of parent process of the calling process
(D) error value
128) Which of the following is true?
(A) Memory management manages memory allocation for processes, which includes how memory is
allocated to a process and what to do when memory is fully utilized.
(B) Process management manages memory allocation for processes.
(C) Memory management manages the behavior and resources of a [Link] includes process
execution, resource allocation and protection, and synchronization.
(D) None
129) Which one of the following challenges relate specifically to the operating system services?
(A) Software decomposition into instructions or sets of tasks that need to execute simultaneously
(B) Communication between two or more tasks that are executing in parallel
(C) Concurrently accessing or updating data by two or more instructions or tasks
(D) All of the above
130) C++ developer using any of today’s modern operating systems has which basic choices for
implementing the tasks.
(A) Processes
(B) Threads
(C) Both
(D) None
131) Which one of the following is true regarding the POSIX Message Queue Functions
i)mq _send(): Establishes the connection between a process and a message queue with a
message queue descriptor
ii)mq _notify(): Registers the calling process to be notified of a message arriving at an empty
message queue that is associated with the specified message queue descriptor
iii)mq _setattr(): Sets the status information and attributes of the message queue
(A) i,ii
(B) i,iii
(C) only i
(D) ii,iii
132) Which of the following statement describes characteristics of pthread_create()
(A) It is operating system API
(B) It is used to associate a software task with a thread
(C) It falls under the process management duties of the operating system
(D) All of the above
133) Match the following in therms (a,b,c,d) of POSIX Scheduling Policies with i,ii,iii,iv
a) SCHED_FIFO
b) SCHED_RR
c) SCHED_SPORADIC
d) SCHED_OTHER
i)When the quantum expires, the thread is placed at the head of the queue of its priority level.
ii)When the quantum expires, the thread is placed at the end of the queue of its priority level.
iii)Sporadic server scheduling policy.
iv)Implementation defined; the most effective scheduling policy for general use.
(A) a-i,b-iii,c-iv,d-ii
(B) a-i,b-ii,c-iii,d-iv
(C) a-ii,b-iii,c-iv,d-i
(D) None
134) Which one of the following challenges relate specifically to the operating system services?
i)Identifying the relationships between concurrently executing pieces of tasks
ii)Controlling resource contention when there is a many - to - one ratio between tasks and resource
iii)Determining an optimum or acceptable number of units that need to execute in parallel
iv)Documenting and communicating a software design that contains multiprocessing and
multithreading
(A) i,ii
(B) iii,iv
(C) i,ii,iii
(D) All of the above
135) Which is true regarding posix_spawn() function?
i)posix_spawn() is used to create a new operating system process.
ii)posix_spawn() is not part of the operating system’s process management API.
iii)We can pass the task that we want to associate with an operating system process to posix_spawn().
(A) i,iii
(B) i,ii
(C) ii,iii
(D) i,ii,iii
136) Which one of the following challenges relate specifically to the operating system services?
(A) Creating a test environment that simulates the parallel processing requirements and conditions
(B) Recreating a software exception or error in order to remove a software defect
(C) Involving the operating system and compiler interface components of multithreading and
multiprocessing
(D) All of the above
137) Which is false regarding posix_spawn() function?
i)Any task associated to a process through posix_spawn() can be scheduled by the operating system to
run in parallel with other processes.
ii)posix_spawn() is used to create a new operating system process.
(A) i,ii
(B) only i
(C) only ii
(D) None
138) What is the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using
[Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;bord
er:solid gray;border-width:.1em .1em .1em
.8em;padding:.2em .6em;"><pre style="margin: 0; line-
height: 125%"><span style="color: #4c8317">#include
<stdio.h></span>
<span style="color: #4c8317">#include
<stdlib.h></span>
<span style="color: #4c8317">#include
<pthread.h></span>
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr );
main()
{
pthread_t thread1, thread2;
<span style="color: #00aaaa">char</span> *message1 =
<span style="color: #aa5500">"Thread 1"</span>;
<span style="color: #00aaaa">char</span> *message2 =
<span style="color: #aa5500">"Thread 2"</span>;
<span style="color: #00aaaa">int</span> iret1,
iret2;
iret1 = pthread_create( &thread1, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message1);
iret2 = pthread_create( &thread2, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message2);
pthread_join( thread1, <span style="color:
#00aaaa">NULL</span>);
pthread_join( thread2, <span style="color:
#00aaaa">NULL</span>);
printf(<span style="color: #aa5500">"Thread 1
returns: %d\t"</span>,iret1);
printf(<span style="color: #aa5500">"Thread 2
returns: %d\t"</span>,iret2);
exit(<span style="color: #009999">0</span>);
}
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr )
<span style="color: #00aaaa">char</span> *message;
message = (<span style="color: #00aaaa">char</span>
*) ptr;
printf(<span style="color: #aa5500">"%s
\n"</span>, message);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using
[Link] -->
(A) Thread 1 returns: 0 Thread 2 returns: 0
(B) Thread 1 returns: 1 Thread 2 returns: 1
(C) Thread 1 returns: 0 Thread 2 returns: 1
(D) None
139) What is the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using
[Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;bord
er:solid gray;border-width:.1em .1em .1em
.8em;padding:.2em .6em;"><pre style="margin: 0; line-
height: 125%"><span style="color: #4c8317">#include
<stdio.h></span>
<span style="color: #4c8317">#include
<stdlib.h></span>
<span style="color: #4c8317">#include
<pthread.h></span>
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr );
main()
pthread_t thread1, thread2;
<span style="color: #00aaaa">char</span> *message1 =
<span style="color: #aa5500">"Thread 2"</span>;
<span style="color: #00aaaa">char</span> *message2 =
<span style="color: #aa5500">"Thread 1"</span>;
<span style="color: #00aaaa">int</span> iret1,
iret2;
iret1 = pthread_create( &thread1, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message1);
iret2 = pthread_create( &thread2, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message2);
pthread_join( thread1, <span style="color:
#00aaaa">NULL</span>);
pthread_join( thread2, <span style="color:
#00aaaa">NULL</span>);
printf(<span style="color: #aa5500">"Thread 1
returns: %d\t"</span>,iret1);
exit(<span style="color: #009999">0</span>);
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr )
<span style="color: #00aaaa">char</span> *message;
message = (<span style="color: #00aaaa">char</span>
*) ptr;
printf(<span style="color: #aa5500">"%s
\t"</span>, message);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using
[Link] -->
(A) Thread 2 Thread 1 Thread 1 returns:0
(B) Thread 2 Thread 1 Thread 1 returns:1
(C) Thread 1 Thread 2 Thread 1 returns:0
(D) Thread 1 Thread 2 Thread 1 returns:1
140) What is the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using
[Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;bord
er:solid gray;border-width:.1em .1em .1em
.8em;padding:.2em .6em;"><pre style="margin: 0; line-
height: 125%"><span style="color: #4c8317">#include
<stdio.h></span>
<span style="color: #4c8317">#include
<stdlib.h></span>
<span style="color: #4c8317">#include
<pthread.h></span>
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr );
main()
pthread_t thread1, thread2;
<span style="color: #00aaaa">char</span> *message1 =
<span style="color: #aa5500">"Thread-2"</span>;
<span style="color: #00aaaa">char</span> *message2 =
<span style="color: #aa5500">"Thread-1"</span>;
<span style="color: #00aaaa">int</span> iret1,
iret2;
iret1 = pthread_create( &thread1, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message1);
iret2 = pthread_create( &thread2, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message2);
pthread_join( thread1, <span style="color:
#00aaaa">NULL</span>);
pthread_join( thread2, <span style="color:
#00aaaa">NULL</span>);
exit(<span style="color: #009999">0</span>);
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr )
<span style="color: #00aaaa">char</span> *message;
message = (<span style="color: #00aaaa">char</span>
*) ptr;
printf(<span style="color: #aa5500">"%s
"</span>, message);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using
[Link] -->
(A) Thread-1 Thread-2
(B) Thread-2 Thread-1
(C) It depends
(D) None
141) What is the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using
[Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;bord
er:solid gray;border-width:.1em .1em .1em
.8em;padding:.2em .6em;"><pre style="margin: 0; line-
height: 125%"><span style="color: #4c8317">#include
<stdio.h></span>
<span style="color: #4c8317">#include
<stdlib.h></span>
<span style="color: #4c8317">#include
<pthread.h></span>
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr );
main()
pthread_t thread1, thread2;
<span style="color: #00aaaa">char</span> *message1 =
<span style="color: #aa5500">"Thread-2"</span>;
message1 = <span style="color:
#aa5500">"Thread-1"</span>;
<span style="color: #00aaaa">int</span> iret1,
iret2;
iret1 = pthread_create( &thread1, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message1);
iret2 = pthread_create( &thread2, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message2);
pthread_join( thread1, <span style="color:
#00aaaa">NULL</span>);
pthread_join( thread2, <span style="color:
#00aaaa">NULL</span>);
exit(<span style="color: #009999">0</span>);
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr )
<span style="color: #00aaaa">char</span> *message;
message = (<span style="color: #00aaaa">char</span>
*) ptr;
printf(<span style="color: #aa5500">"%s
"</span>, message);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using
[Link] -->
(A) Thread-1 Thread-2
(B) Thread-2 Thread-1
(C) Error
(D) None
142) What is the output of the following code?
<!-- HTML generated at Sahil's Blog [Link] using
[Link] --><div style="background: #ffffff;
overflow:auto;width:auto;color:black;background:white;bord
er:solid gray;border-width:.1em .1em .1em
.8em;padding:.2em .6em;"><pre style="margin: 0; line-
height: 125%"><span style="color: #4c8317">#include
<stdio.h></span>
<span style="color: #4c8317">#include
<stdlib.h></span>
<span style="color: #4c8317">#include
<pthread.h></span>
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr );
main()
pthread_t thread1;
<span style="color: #00aaaa">char</span> *message1 =
<span style="color: #aa5500">"Thread-2"</span>;
message1 = <span style="color:
#aa5500">"Thread-1"</span>;
<span style="color: #00aaaa">int</span> iret2;
iret2 = pthread_create( &thread1, <span
style="color: #00aaaa">NULL</span>,
print_message_function, (<span style="color:
#00aaaa">void</span>*) message1);
pthread_join( thread1, <span style="color:
#00aaaa">NULL</span>);
exit(<span style="color: #009999">0</span>);
<span style="color: #00aaaa">void</span>
*print_message_function( <span style="color:
#00aaaa">void</span> *ptr )
<span style="color: #00aaaa">char</span> *message;
message = (<span style="color: #00aaaa">char</span>
*) ptr;
printf(<span style="color: #aa5500">"%s
"</span>, message);
</pre></div>
<!-- HTML generated at Sahil's Blog [Link] using
[Link] -->
(A) Thread-2
(B) Thread-1
(C) Error
(D) None