Device Drivers Interview Questions And Answers
Download Linux Device Drivers Interview Questions and Answers PDF
Refine your Linux Device Drivers interview skills with our 19 critical questions. These questions will test your expertise and readiness for any Linux Device Drivers interview scenario. Ideal for candidates of all levels, this collection is a must-have for your study plan. Secure the free PDF to access all 19 questions and guarantee your preparation for your Linux Device Drivers interview. This guide is crucial for enhancing your readiness and self-assurance.
19 Linux Device Drivers Questions and Answers:
Linux Device Drivers Job Interview Questions Table of Contents:
1 :: If we use a driver for various device files, then:
a) minor number will be different for every device file
b) minor number will be same for every device file
c) minor number can not be allocated for any device file
d) none of the mentioned
a) minor number will be different for every device file
Read More2 :: In linux kernel 2.1, the minor numbers were used to:
a) represent the sub-functionalitites of the driver
b) identify the driver
c) represent the device files
d) none of the mentioned
a) represnt the sub-functionalitites of the driver
Read More3 :: In linux, a device driver can work without the:
a) major number
b) minor number
c) device file name
d) none of the mentioned
d) none of the mentioned
Read More4 :: In we use a driver for N number of files, then we have to create ____ device files.
a) N
b) 1
c) N-1
d) none of the mentioned
a) N
Read More5 :: The minor number range should be:
a) 0 to 15
b) 0 to 63
c) 0 to 255
d) none of the mentioned
c) 0 to 255
Read More6 :: Which one of the following is not true?
a) dynamic allocation of major numbers is not possible
b) major number can not be shared among drivers
c) both (a) and (b)
d) none of the mentioned
c) both (a) and (b)
Read More7 :: What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int ptr;
ptr = (int)malloc(sizeof(int)*10);
return 0;
}
a) syntax error
b) segmentaion fault
c) run time error
d) none of the mentioned
d) none of the mentioned
Explanation:
The memory has been allocated but we can not access rest of the memory other than 4 bytes.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
[root@localhost google]#
Read MoreExplanation:
The memory has been allocated but we can not access rest of the memory other than 4 bytes.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
[root@localhost google]#
8 :: What is the output of this program?
#include<stdio.h>
#inlcude<stdlib.h>
int main()
{
int *ptr;
double *ptr;
printf("%dn",sizeof(ptr));
return 0;
}
a) 4
b) 8
c) the compiler will give the error
d) segmentaion fault
c) the compiler will give the error
Explanation:
Just see the output carefully.
Output:
[root@localhost google]# gcc -o san san.c
san.c: In function 'main':
san.c:8:10: error: conflicting types for 'ptr'
san.c:7:7: note: previous declaration of 'ptr' was here
[root@localhost google]#
Read MoreExplanation:
Just see the output carefully.
Output:
[root@localhost google]# gcc -o san san.c
san.c: In function 'main':
san.c:8:10: error: conflicting types for 'ptr'
san.c:7:7: note: previous declaration of 'ptr' was here
[root@localhost google]#
9 :: In this program the two printed memory locations has the difference of ___ bytes.
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr;
ptr = (int*)malloc(sizeof(int)*2);
printf("%pn",ptr);
printf("%pn",ptr+1);
return 0;
}
a) 1
b) 4
c) can not be determined
d) none of the mentioned
b) 4
Explanation:
Pointer will increment by 4 bytes because it is the types of integer.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
0x9b4e008
0x9b4e00c
[root@localhost google]#
Read MoreExplanation:
Pointer will increment by 4 bytes because it is the types of integer.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
0x9b4e008
0x9b4e00c
[root@localhost google]#
10 :: Which one of the following in true about this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr;
printf("%pn",ptr);
ptr = (char *)malloc(sizeof(char));
printf("%pn",ptr);
return 0;
}
a) this program will give segmentation fault
b) this program will print two same values
c) this program has some syntax error
d) none of the mentioned
d) none of the mentioned
Explanation:
This program will print two different values.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
0x4a77cff4
0x980c008
[root@localhost google]#
Read MoreExplanation:
This program will print two different values.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
0x4a77cff4
0x980c008
[root@localhost google]#
11 :: What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr;
ptr = (char*)malloc(sizeof(char)*11);
strcpy(ptr,"google");
printf("%dn",*ptr);
return 0;
}
a) s
b) google
c) 115
d) segmentation fault
c) 115
Explanation:
This program will print the equivalent decimal value at location pointed by "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
115
[root@localhost google]#
Read MoreExplanation:
This program will print the equivalent decimal value at location pointed by "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
115
[root@localhost google]#
12 :: Tell me what is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr;
memcpy(ptr,"google",11);
printf("%sn",ptr);
return 0;
}
a) google
b) segmentation fault
c) syntax error
d) none of the mentioned
b) segmentation fault
Explanation:
Memory must be allocated to pointer "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Segmentation fault (core dumped)
[root@localhost google]#
Read MoreExplanation:
Memory must be allocated to pointer "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Segmentation fault (core dumped)
[root@localhost google]#
13 :: What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
int main()
{
char *ptr;
free(ptr);
return 0
}
a) this program will print nothing after execution
b) segmentation fault
c) Aborted (core dumped)
d) none of the mentioned
c) Aborted (core dumped)
Read More14 :: This program will allocate the memory of ___ bytes for pointer "ptr".
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr;
ptr = realloc(0,sizeof(int)*10);
return 0;
}
a) 0
b) 10
c) 40
d) none of the mentioned
c) 40
Explanation:
If the first argument of realloc() is NULL, then it behaves just like malloc().
Read MoreExplanation:
If the first argument of realloc() is NULL, then it behaves just like malloc().
15 :: Do you know what is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr;
memcpy(ptr,"google",11);
printf("%sn",ptr);
return 0;
}
a) google
b) segmentation fault
c) syntax error
d) none of the mentioned
b) segmentation fault
Explanation:
Memory must be allocated to pointer "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Segmentation fault (core dumped)
[root@localhost google]#
Read MoreExplanation:
Memory must be allocated to pointer "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Segmentation fault (core dumped)
[root@localhost google]#
16 :: The connection between the device file and device driver is based on the:
a) name of device file
b) number of device file
c) both (a) and (b)
d) none of the mentioned
b) number of device file
Read More17 :: In linux kernel 2.4, we can have:
a) 256 character drivers only
b) 256 block drivers only
c) 256 character drivers and 256 block drivers at the same time
d) none of the mentioned
c) 256 character drivers and 256 block drivers at the same time
Read More18 :: The kernel identifies the driver with its:
a) module
b) major number
c) device file
d) none of the mentioned
b) major number
Read More19 :: The major number identifies the _____ associated with the device.
a) driver
b) protocol
c) port
d) none of the mentioned
a) driver
Read More