Linux Set 4 ( 30 mcqs)

1. Command used to check shared memory is
a) ipcs
b) ipcs  -m
c) ipcs  -s
d) ipcs  -q

2. Which is Fastest IPC?
a) Message Queue
b) shared memory
c) Socket
d) all

3. What is the persistancy level of Shared memory segments?
a) signal
b) process
c) file system
d) kernel

4. The structure which keeps the information about shared memory in  the kernel is
a) struct ipc_perm
b) struct semid_ds
c) struct shmid_ds
d) struct msgid_ds

5. One process requires M resource to complete a job. What should be the minimum number of resources available for N processes so that at least one process can continue to execute without blocking/waiting?
a) M * N
b) M * N – 1
c) M * N + 1
d) M

6. Semaphore P( ) operation usually does the following:
a) descrements the semaphore count and the process sleeps if needed
b) increments the semaphore count
c) wakes up a sleeping process

7. Which call to use to set the resource count of semaphore?
a) semget( )
b) semctl( )
c) sem_setcount( )
d) sem_set_count( )

8. Race condition can be avoided by using
a) semaphore
b) mutex
c) Socket
d) both a & b

9. A server which is handling one client at a time is called as
a) single server
b) multiserver
c) concurrent server
d) iterative server

10. A server which is handling many clients at a time is called as
a) single server
b) multiserver
c) concurrent server
d) iterative server

11. What is a context switch?
a) Kernel switches from executing one process to another.
b) Process switches from kernel mode to user mode.
c) Process switches from user mode to kernel mode.
d) None of the above

12. Pid of init process
a) 0
b) 1
c) 32767
d) none of the above

13. What is the default maximum number of processes that can exist in Linux?
a) 32768
b) 1024
c) 4096
d) unlimited

14. How do you get parent process identification number?
a) waitpid
b) getpid()
c) getppid()
d) parentid()

15. Parent process id of a deamon process is_________________.
a) 1
b) 2
c) 3
d) None of the above

16. The process which terminates before the parent process exits becomes
a) Zombie
b) Orphan
c) Child
d) None of the above

17. Return value of fork() system call can be:
a) -1,<0,0
b) -1,>0,0

18. If the fork() system call returns -1, then it means?
a) No new child process is created
b) The child process is an orphan
c) The child process is in Zombie

19. Fork returns _____ to parent process on success
a) 0
b) child process id
c) parent process id
d) none

20. How many times printf() will be executed in the below mentioned program?
main() {
int i;
for (i = 0; i < 4; i++)
fork();

printf(“my pid = %d\n”, getpid());
}
a) 4
b) 8
c) 16
d) 32

21. What is the output of the below code?
void exit_handler1();
void exit_handler2();
int main() {
int pid;
atexit(exit_handler1);
atexit(exit_handler2);
pid = fork();
if(pid == 0) {
_exit(0);
} else {
sleep(2);
exit(0);
}
return 0;
}
a) Only child executes the exit_handler 1 and 2.
b) Only parent executes the exit_handler 1 and 2.
c) Both parent and child executes the exit_handler 1 and 2.
d) Neither parent nor child executes the exit_handler 1 and 2.

22. What is output of the following program?

int main() {
fork();
fork();
fork();
if (wait(0) == -1)
printf(“leaf child\n”);
}
a) “leaf child” will be printed 1 times
b) “leaf child” will be printed 3 times
c) “leaf child” will be printed 4 times
d) “leaf child” will be printed 8 times

23. Which niceness value among the following indicate most favorable scheduling?
a) 0
b)  19
c)  5
d)  -20

24. The maximum time slice that can be given to a process in Linux (where tick is 10ms) is
a) 150ms
b) 10ms
c) 300 ms
d) 600ms

25. Nice can be used by an ordinary process to
a) increase the priority of a process
b) decrease the priority of a process
c) increase or decrease the priority of a process

26. Which one can be a real time schedule policy?
a) SCHED_FIFO
b) SCHED_SPF
c) SCHED_OTHER
d) SCHED_FILO

27. In Linux kernel-2.6 Real time priority ranges from
a) 0 to 99
b) 0 to 139
c) -20 to 19
d) 100 to 139

28. Solaris real time class priority is
a) 0-59
b) 60-99
c) 100-159
d) 160-169

29. Solaris System class priority is
a) 0-59
b) 60-99
c) 100-159
d) 160-169

30. A communication end-point is identified by
a) IP address
b) port number
c) both a and b
d) none

Answers

1-b 2-b 3-d 4-c 5-d
6-a 7-d 8-d 9-d 10-c
11-a 12-b 13-a 14-c 15-a
16-a 17-b 18-a 19-b 20-c
21-b 22-c 23-d 24-d 25-b
26-a 27-a 28-c 29-b 30-c

Sharing is caring!

Leave a Comment

Your email address will not be published. Required fields are marked *

shares