Unix written test for experience

                 


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

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

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

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

Answer:c
5. Parent process id of a deamon process is_________________.

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

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

Answer:b
8. 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

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

Answer:b
10. 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

Answer:c
11. 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.

Answer:b
12. 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

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

Answer:d
14. 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

Answer:d
15. 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

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

Answer:a
17. 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

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

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

Answer:b



EmoticonEmoticon