Q – 1 Which is loaded into memory when system is booted?
a) Kernel
b) Shell
c) Commands
d) Script
Ans- a) Kernel
Q – 2 Which file is read by init to get the default run-level?
a) /etc/profile
b) /etc/init
c) /etc/boot
d) /etc/inittab
Ans- d) /etc/inittab
Q – 3 Which of the following is not a valid run-level?
a) S
b) 0
c) 8
d) 1
Ans- c) 8
Q – 4 On Linux, initrd is a file:
a) containing root file-system required during bootup
b) Contains only scripts to be executed during bootup
c) Contains root-file system and drivers required to be preloaded during bootup
d) None of the above
Ans- c) Contains root-file system and drivers required to be preloaded during bootup
Q – 5 What is the output of this program?
#include
int main()
{
int *ptr;
ptr = (int *)calloc(1,sizeof(int));
*ptr = 10;
printf(“%dn”,*ptr);
return 0;
}
a) 0
b) -1
c) 10
d) none of the mentioned
Ans- d) none of the mentioned
Q – 6 Do you have any idea what is the output of this program?
#include
#include
int main()
{
int *ptr;
*ptr = 10;
*ptr = 20;
printf(“%dn”,*ptr);
return 0;
}
a) 10
b) 20
c) segmentation fault
d) none of the mentioned
Ans- c) segmentation fault
Q – 7 What is the output of this program?
#include
#include
int main()
{
int *ptr1, *ptr2;
ptr1 = malloc(4);
*ptr1 = 10;
*ptr2 = free(ptr1);
printf(“%dn”,*ptr2);
return 0;
}
a) 10
b) it will print the address stored in ptr1
c) it will print the address stored in ptr2
d) it will give an error
Ans- d) it will give an error
Q – 8 What is the output of this program?
#include
#include
int main()
{
int *ptr1;
while(1){
ptr1 = malloc(1024*1024);
if(ptr1 == 0)
break;
sleep(1);
printf(“googlen”);
free(ptr1);
}
return 0;
}
a) it will print “google” until the process has been stopeed by any signal
b) it will print nothing
c) segmentation fault
d) none of the mentioned
Ans- a) it will print “google” until the process has been stopeed by any signal
Q – 9 What is the output of this program?
#include
#include
int main()
{
int ret;
int *ptr;
ptr = (int *)malloc(sizeof(int)*10);
free(ptr);
free(ptr);
return 0;
}
a) it will print nothing
b) it will give segmentaion fault
c) undefined behaviour
d) none of the mentioned
Ans- c) undefined behaviour
Q – 10 In which condition this prgram will print the string “google”?
#include
#include
int main()
{
int *ptr;
ptr = (int *)malloc(sizeof(int)*10);
if (ptr == NULL)
printf(“googlen”);
return 0;
}
a) if the memory could not be allocated to the pointer “ptr”
b) if the memory has been allocated to the pointer “ptr” successfully
c) it will never print
d) none of the mentioned
Ans- a) if the memory could not be allocated to the pointer “ptr”
Q – 11 Program given below will allocate the memory of ___ bytes for pointer “ptr”.
#include
#include
int main()
{
int *ptr;
ptr = (int*)malloc(sizeof(int)*4);
ptr = realloc(ptr,sizeof(int)*2);
return 0;
}
a) 2
b) 4
c) 8
d) none of the mentioned
Ans- c) 8
Q – 12 Please tell me output of this program?
#include
#include
int main()
{
int *ptr;
ptr = (int *)calloc(1,sizeof(int));
if (ptr != 0)
printf(“%dn”,*ptr);
return 0;
}
a) 0
b) -1
c) garbage value
d) none of the mentioned
Ans- a) 0
Q – 13 In this program the allocated memory block can store
#include
#include
int main()
{
int *ptr;
ptr = malloc(10);
return 0;
}
a) int
b) char
c) float
d) all of the mentioned
Ans- d) all of the mentioned
Q – 14 The process of starting up a computer is known as:
a) Boot Loading
b) Boot Record
c) Boot Strapping
d) Booting
Ans- c) Boot Strapping
Q – 15 At the end of kernel bootstrap, which process is started?
a) /etc/init
b) /etc/sched
c) /etc/swap
d) /etc/kernel
Ans- a) /etc/init
Q – 16 Bootstrapping is also known as:
a) Quick boot
b) Cold boot
c) Hot boot
d) Fast boot
Ans- b) Cold boot
Q – 17 The shell used for Single user mode shell is:
a) bash
b) Csh
c) ksh
d) sh
Ans- d) sh
Q – 18 The process id of init process is:
a) -1
b) 0
c) 1
d) 2
Ans- c) 1
Q – 19 Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is needed?
a) Sched daemon
b) Swap daemon
c) Init daemon
d) Process daemon
Ans- b) Swap daemon
Q – 20 Which is the only partition mounted in Single user mode?
a) boot
b) usr
c) root
d) tmp
Ans- c) root
Q – 21 Single user mode shell runs as:
a) Admin user
b) Root user
c) normal user
d) Log user
Ans- b) Root user