LDD Dumps
LDD Dumps
LDD Dumps
http://www.mcqtutorial.com/MCQ/Linux/File%20and%20Folder/115_161_21.php
Q9. There are two hard links to the “file1″ say hl and h2 and a softlink sl. What
happens if we
deleted the “file1″?
a) We will still be able to access the file with hl and h2 but not with sl
b) We will not be able to access the file with hl and h2 but with sl
c) We will be able to access the file with any of hl, h2 and sl
d) We will not be able to access the file with any of hl, h2 and sl
Q10. Which of the following statement is true?
a) The cp command will preserve the meta data of the file
b) The sort command by default sorts in the numeric order
c) The mv command will preserve the meta data of the file
d) The command ps will display the filesystem usage
Q11. What UNIX command is used to update the modification time of a file?
a) time
b) modify
c) cat
d) touch
Q12. 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
Q13. A user issues the following command sequence:
$ a.out &
$ bash
$ a.out &
If the user kills the bash process, then which of the following is true?
a) The second a.out process is also terminated
b) The second a.out process becomes a defunct process
c) The first a.out process becomes a zombie process
d) init process becomes parent of second a.out process
Q14. Which variable contains current shell process id
a) $*
b) $?
c) $$
d) $!
Q15. What is the default maximum number of processes that can exist in Linux for 32
bit system?
a) 32768
b) 1024
c) 4096
d) unlimited
Q16. How many times printf() will be executed in the below mentioned program?
main() {
int i;
for (i = 0; i < 4; i++)
fork();
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
Q18. 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
Q21 The loglevel strings in printk are defined in the header file
1. For a device driver to access the I/O memory address it must be mapped to
virtual address.
This can be done by using the function
A. ioremap();
B. io_map();
C. request_mem_region();
D. both (A) and (B)
Paper Code
E5
4. mknod is used for creating
A. character device file
B. block device file
C. FIFO
D. all of the above
Paper Code
E5
10. Which of the following is true for the 'dev_t' data type?
A. it is used to hold the driver name
B. it is used to hold the major-minor number
C. it holds the major-minor numbers and the driver name
D. none of the above
Paper Code
E5
14. The field in the file operation structure which is not an operation at all
A. ssize_t read();
B. loff_t *llseek();
C. struct module *owner;
D. int *ioctl();
Paper Code
E5
15. The function which is used to allocate and initialize a character device
A. int register_chrdev_region();
B. void chdev_init();
C. int register_chrdev_region();
D. int register_chrdev();
16. What is the preferred mechanism to dynamically find out the IRQ number of a
device?
A. probing
B. seeking
C. polling
D. masking
18. Find the odd function out with reference to short delays inside the kernel
A. ndelay();
B. udelay();
C. mdelay();
D. pdelay();
19. A character device driver is written to access the serial port of the PC. The
driver requests a
device number from the kernel by calling the function 'alloc_chrdev_region'. The
kernel
allocates the Major-Minor number combination of 253,0.
Using which utility can a user space application create a device node to access the
driver?
Can two device nodes be created bearing the same major-minor number combination?
A. mknod, TRUE
B. mknod, FALSE
C. mkdev, TRUE
D. mkdev, FALSE
20. What will happen if the return a negative value from the module initialization
function
(init_module)?
A. kernel crashes
B. error during compilation of the module
C. error while inserting the module
D. no problems will arise
Paper Code
E5
21. If a function or variable defined in one driver is to be shared with other
drivers, which of the
following functions should be called?
A. module_param
B. EXPORT_SYMBOL()
C. module_param_novers
D. module_param_novers
22. If you export any symbol from your driver, if you want to see the exported
symbols, which
file you need to refer ...................
A. /proc/symbols
B. /proc/ksyms
C. /proc/kcallsyms
D. none of the above
23. In a module if its license is not explicitly specified its default license
would be
A. GPL
B. GPLV2
C. Dual BSD/GPL
D. Proprietary
Paper Code
E5
Paper Code
E5
30. The function ............is used to copy a kernel data segment to user data
segment
A. get_user
B. put_user
C. write_to_user
D. copy
34. Which of the following functions is used for I/O port allocation?
A. request_region();
B. check_region();
C. register_io_region();
D. alloc_io_region();
Paper Code
E5
35. Find the odd option out with reference to f_flags in the file structure
A. O_RDONLY
B. O_NONBLOCK
C. O_SYNC
D. FMODE_READ
36. There is a driver which executes in the kernel. The driver implements the open,
read, write
and close functions apart from module initialization and cleanup. In the user
space, there are
number of read and write applications working on the driver. Every write should be
signaled
by the read. In such scenarios, where should the function 'init_completion' be
called?
37. In which method of a character driver should the functions 'cdev_init' and
'cdev_add' be
called? Choose the most appropriate answer?
Paper Code
E5
38. The loglevel strings in printk are defined in the header file
A. <linux/module.h>
B. <linux/init.h>
C. <linux/kernel.h>
D. <linux/fs.h>
A. 1MB
B. 512 bytes
C. 256 bytes
D. 8 bits
A. bus number
B. device number
C. function number
D. all
10. Which of the following macros is used to pass an array as a parameter to the
kernel
module?
()a module_param_array (name, type, num, perm);
()b module_param(name, type, num, perm);
()c module_param_char[size](name, type, perm);
()d module_param[size](name, type, num, perm);
11. Which of the following is true for the 'dev_t' data type?
()a It is used to hold the driver name
()b It is used to hold the Major-Minor number
()c It holds the Major-Minor numbers and the driver name
()d None of the above
12. Which of the following functions should preferably be called when passing
single
value data from the user space to the kernel space in the IOCTL method
implementation?
()a copy_from_user
()b copy_to_user
()c put_user
()d get_user
13. An OOPS message is generated
()a When a null pointer is dereferenced in the driver
()b When an invalid pointer is dereferenced and the processor signals page
faults
()c Both (a) and (b)
()d None of the above
14. Read and Write user address verification can be implemented by which of the
following functions?
()a put_user
()b get_user
()c access_ok
()d capable
15. Which of the following delayed execution methods allows sleeping inside the
scheduled task?
()a Work queues
()b Kernel timers
()c Tasklets
()d Both (a) & (b)
16. The significance of __put_user() in GNU/Linux device driver is ______________.
a)facilitating slower data transfer to user space as compared to __copy_to_user()
b)facilitating slower data transfer to user space as compared to copy_to_user()
c)facilitating slower data transfer to user space as compared to put_user()
d)facilitating transfer of single values to user space without type checking
17. Which of the following functions is used for I/O port allocation?
(a) request_region();
(b) check_region();
(c) register_io_region();
(d) alloc_io_region();
18. Function used for the device number allocation request_chrdev_region(dev_t
devno
, int count , char *name) , in that function what is the significance of the char
*name
argument?
a)Gets entry into /proc/devices
b)Gets entry into /proc/kallsysms
c)Gets entry into /proc/modules
d)None of the above
19. What is the preferred mechanism to dynamically find out the IRQ number of a
device?
(a) Probing
(b) Seeking
(c) Polling
(d) Masking
20. In a kernel Makefile, the tag 'obj-m' compiles the source code as
(a) A dynamically loadable module
(b) A systems call
(c) A statically built in module
(d) The kernel core component
21. Find the odd option out with reference to f_flags in the file structure
a)O_RDONLY
b)O_NONBLOCK
c)O_SYNC
d)FMODE_READ
22. Which of the following should be avoided in the interrupt handlers
(a) calling wait_event/allocating memory
(b) calling schedule
(c) locking a semaphore
(d) all of the above
23. Find the odd function out with reference to short delays inside the kernel
(a) ndelay();
(b) udelay();
(c) mdelay();
(d) pdelay();
24. When the flag IRQF_SHIRQ is passed to the request_irq function it is mandatory
to
also pass
(a) Device Name
(b) Handler
(c) Handler Argument
(d) DeviceID
25. IRQ Line Probing is applicable to
(a) Sharable interrupts
(b) Non Sharable Interrupts
(c) Both
(d) None
26. Work Queues always runs in
(a) Process Context
(b) Interrupt Context
(c) a&b
(d) None of the above
Two Marks Questions:
(2 marks)
dependencies
(2 marks)
involving pointers
( 2 marks)
29. A character device driver is written to access the serial port of the PC. The
driver
requests a device number from the kernel by calling the function
(2 marks)
30. The serial port has to be configured to set the Baud rate as 9600 baud.
Assuming
that the ordinal number is 1 and the letter 'k' is not used in the file
ioctl-number.txt,
compute the definition for the magic number used as part of the ioctl method
implementation
(a) _IOW('k', 1, int)
(b) _IOR('k', 1, int)
(c) _IO('k', 1, int)
(d) _IO('k', '1', char)
( 2 marks)
31. Explain what will happen if the return a negative value from the module
initialization
function (init_module) ?
(a) Kernel crashes
(b) Error during compilation of the module
(c) Error while inserting the module
(d) No problems will arise
( 2 marks)
32. There is a driver which executes in the kernel. The driver implements the open,
read, write and close functions apart from module initialization and cleanup. In
the
user space, there are number of read and write applications working on the driver.
Every write should be signalled by the read. In such scenarios, where should the
function 'init_completion' be called?
(a) In the init_module of the driver
(b) In the open function implemented by the driver
(c) Does not have to be called. The kernel takes care of it
(d) In the read function of the driver
( 2 marks)
33. In which method of a character driver should the functions 'cdev_init'
and
'cdev_add' be called? Choose the most appropriate answer
(a) Module init function and module open function respectively
(b) Both in module init function
(c) Both in open function
(d) None of the above
1.You are working with Embedded Linux based hardware and you need to troubleshoot a
network card problem.You want to know which IRQ channel the card is using. Which
file would
tell you the IRQ channel for the card?
A) /proc/interrupts
B) /proc/ioports
C) /proc/irqs
D) /proc/interrupt
2.Using which utility in linux, will load the kernel module
A) insmod
B) rmmod
C) dmesg
D) load
3. Read and Write user address verification can be implemented by which of the
following
functions?
A) access
B) put_user
C) get_user
D) capable
4. Find the odd function out with reference to short delays inside the kernel
A) ndelay();
B) udelay();
C) mdelay();
D) pdelay();
5. When the flag IRQF_SHIRQ is passed to the request_irq function it is mandatory
to also pass
A) DeviceName
B) Handler
C) HandlerArgument
D) DeviceID
Q. No.1
Question:
An interrupt handler can be registered by using the function
a)request _irq
b) request_region
c) request_mem_region
d) request_irq_region
Q. No.2.
Question:
“kernel is tainted” message will be produced when the module is inserted without
a)MODULE_AUTHOR
b) MODULE_LICENSE
c) MODULE_VERSION
d) MODULE_DESCRIPTION
Q. No.3.
Question:
Q. No.5
Question:
mknod is
used for creating
a)Character device file
b) block device file
c) FIFO
Q. No.9
Question:
GPL stands for
Q. No.10
Question:
inb_p is used for
a) get a byte of data from specific port with pausing
b) get a word of data from specific port
c) get a bit of data from specific port
d) get a word of data from a specific port with pausing
Q. No.11
Question:
SCHAR_MAJOR is defined in
a) schar.h
b) module.h
c) stdio.h
d) kernel.h
Q. No.12
Question:
Q. No.13
Question:
Which represents the user home directory
a) /
b) .
c) ..
d) ~
Q. No.14 When using shared interrupts, if our driver handler is invoked but the
hardware device has not generated the interrupt , what should the handler return
a)IRQ_HANDLED
b) IRQ_RESET
c) IRQ_NONE
d) IRQ_CONTINUE
Q. No.15
Question:
EXPORT_SYMBOL is used for
Q. No.16.
Question:
SMP stands for
a) simple machine process
b) symmetric multiprocessor system
c) symmetic module system
d) none of the above
Q. No.17.
Question:
________ structure used by the kernel internally to represent files
a) mknode
b) inode
c) structdev
d) all
Q. No.19.
Question:
USB is
a) character device
b) block device
c) network device
d) all
Q. No. 20.
Question:
Each process has unique
Q. No.21.
Question:
What are the different bottom-half mechanisms in Linux?
a) softirq
b) tasklet
c) workqueues
d) all of the above
Q. No.22.
Question:
If you export any symbol from your driver, if you want to see the exported
symbols,which file you need to refer________
a) /proc/ksyms
b) /proc/symbols
c) /proc/kcallsyms
d) none of the above
Q. No.23
Question:
What command is used to remove files?
a) dm
b) rm
c) delete
d) erase
e) none of the above
Q. No. 25
Question:
Read and write user address verification can be implemented by which of the
following functions?
a) get_user
b) capable
c) own_user
d) access_ok
Q. No.26.
Question:
Application that use non-blocking I/O uses
Q. No.27.
Question:
Full form of SCULL
a) simple character utility for loading localities
b) simple character utility for localities loading
c) simple character utility for link loading
d) none
Q. No.28.
Question:
Header <linux/fs.h> is
a) collection of file pointer
b) collection of function pointer
c) objects of function
d) its not a header file
Q. No.30.
Question:
In Linux device driver which keyword used to allocate memory
a) malloc
b) dmalloc
c) lmalloc
e) kmalloc
Q. No.31.
Question:
For allocating big chunk of memory we use
a) mallocb) lmalloc
Q. No.32.
Question:
Inb & outb are used to read and write
a) 8bytes
b) 1 bit
c) a block
d) 8 bits
Q. No.33.
Question:
Block size in Block devices is of
a) 1MB
b) 512 bytes
c)256 bytes
d) 8 bits
Q. No.34.
Question:
Q. No.35.
Question:
Modules run in
a) user space
b) kernel space
c) anywhere
d) all of these
Q. No.36
Question:
To which directory printk messages goes?
A.
B. /proc/messages
C. /var/log/messages
D. /proc/kall
E. /var/log/message
Q. No.38
Question:
If a function or variable defined in one driver is to be shared with other driver.
Which of
the following functions should be used?
A.
B. module_param
C. EXPORT_SYMBOL()
D. module_param_noversion
E. module_param_version
Q. No.39 .
Question:
In a module if its license is not explicitly specified its default license would be
A.
B. GPL
C. GPLV2
D. Dual BSD/GPL
E. Proprietary