Device Drivers Interview Preparation Guide
Download PDF
Add New Question

Device Drivers frequently Asked Questions by expert members with experience in Linux Device Drivers. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts

19 Linux Device Drivers Questions and Answers:

2 :: 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
Post Your Answer

7 :: 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]#
Post Your Answer

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]#
Post Your Answer

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]#
Post Your Answer
Add New Question