Professional Documents
Culture Documents
72. In x86 architecture system call number can be passed through ____ register.
A: ESP
B: EIP
C: EAX
D: EPB
73. In Linux, compressed kernel image is stored in ____ directory with _____.
A: /boot, vmlinux
B: /boot, vmlinuz
C: /usr/src, vmlinux
D: /lib/modules, vmlinuz
74. ________is an example of CPU instruction to switch from user mode to kernel mode while
invoking system call in
x86 architecture.
A: int 0x80
B: SWI
C: SVC
D: All of the above
75. In Linux process descriptor is stored in ___ header file in _____ structure
A: sched.h, task_descriptor
B: task.h, task_struct
C: sched.h, task_struct
D: task.h, task_descriptor
80. API is used to copy data from user space to kernel space
A: copy_from_user
B: copy_to_user
C: strcpy
D: sprint
81. _____ target of kernel Makefile copies dynamic modules into /lib/modules
A: install
B: modules
C: modules_install
D: install_ modules
82. ________is the versatile command to load modules with dependency resolution.
A: insmod
B: rmmod
C: modprobe
D: lsmod
86. ______command is used to map external file system with an empty dir.
A: mmap
B: mkfs
C: mount
D: fdisk
89. ___ system call is used to change read/write offset with in an open file
A: Istat
B: lseek
C: stat
D: seek
91. ____ proc file displays list of all registered character, block devices along with their major
numbers
A: /proc/modules
B: /proc/modlist
C: /proc/devices
D: /proc/devlist
Date: 16-01-2014
Module Name: Embedded Systems Programming
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)
9. 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);
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
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();
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
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
24. The devices that can host a filesystem
A. character device
B. block devices
C. network interfaces
D. none of the above
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();
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?
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
37. 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
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>
----SUNBEAM----
1. Which of the following option gives hexcode of executable file in objdump tool?
1. inb(), inw(), inl()
2. outb(), outw(), outl()
3. outb_p(), inb_p()
4. All of the above
5. None of the above
4. Which of the following low level functions are not used to access the device?
Answers
1. inb(), inw(), inl()
2. outb(), outw(), outl()
3. outb_p(), inb_p()
4. All of the above
5. None of the above
2. Which of the following verifies that user space buffer can be read/write in kernel space code?
Answers
1. copy_from_user()
2. copy_to_user()
3. access_ok()--A
4. None of these
9. All the details about the module like author, version etc can be viewed by using utility
Answers
1. lsmod
2. modprobe
3. dmesg
4. modinfo--A
10. which function is used to allocated memory for buffer of the USB.
Answers
1. usb_alloc_buffer()
2. usb_buffer_alloc()--A
3. usb_alloc()
4. usb_alloc_urb()
13. which macro is used to add kernel module functions to kernel symbol table?select one:
Answers
1. MODULE_EXPORT()
2. EXPORT_SYMBOL()--A
3. EXPORT_KERNEL()
4. EXPORT_FUNCTION()
14. "kernel is tained" message will be produced when the module is inserted without____________
Answers
1. MODULE_LICENSE--A
2. MODULE_AUTHOR
3. MODULE_VERSION
4. MODULE_DESCRIPTION
15. In the device driver model the device_driver object contains the
Answers
1. name of the device driver
2. embedded kobjects
3. method for probing a device
4. all of the mentioned--A
18. which of the following function is use to wake up a task from wait queue in case of spinlock?
Answers
1. wake_up(&wq)
2. wake_up_interruptible--A
3. wake_spinlock(&wq)
4. none of the above
20. The function which is used to allocate and initialize a character device
Answers
1. int register_chrdev_region();--A
2. void chdev_init();
3. int unregister_chrdev_region();
4. int register_chrdev();
24. In a module if its license is not explicitly specified its default license would be
Answers
1. GPL--A
2. GPLV2
3. Dual BSD/GPL
4. Proprietary
26. which of the following bottom half mechanism can sleep or can be scheduled?
Answers
1. softirq
2. tasklet
3. work queue--A
4. None of the above
27. Which of the following functions is used for I/O port allocation?
Answers
1. request_region();--A
2. check_region();
3. register_io_region();
4. alloc_io_region();
28. In which method of a character driver should the functions 'cdev_init' and 'cdev_add' be called?
Choose the most appropriate answer?
Answers
1. module init function and module open function respectively
2. both in module init function--A
3. both in open function
4. none of the above
29. The loglevel strings in printk are defined in the header file
Answers
1. <linux/module.h>
2. <linux/init.h>
3. <linux/kernel.h>--A
4. <linux/fs.h>
33. The device number which is of 32 bit and consist of _________ bits for major and _______ bits for
minor.
Answers
1. 21, 11
2. 11, 21
3. 20, 12
4. 12, 20--A
3. What is /root?
a) root filesystem
b) home directory of the root user
c) the directory which contains all the directories of the filesystem
d) none of the mentioned
16. Which one of the directory does not contain binary files?
a) /bin
b) /sbin
c) /etc
d) none of the mentioned
8) Which of the following file system exports kernel objects to user space, also observes
properties of kernel internal data structures and modify them?
Select one:
a. proc
b. sysfs
c. Both
d. None
12) A bootloader is responsible for i. loading an operating system kernel and its ii. loading
supporting infrastructure into memory iii. beginning the kernel's execution
Select one:
a. i and ii
b. i and iii
c. ii and iii
d. All of the above
16) Major number identifies the driver associated with the device and Minor number is used to
identify exactly which device is referred to.
Select one: a. True
b. False
17)Which of the following file operation in device driver allows issuing device specific
commands?
Select one:
a. mmap
b. ioctl
c. write
d. None of the above
Select correct option i. cdev_add() Create a device node under /dev ii. cdev_init() associates
major and minor numbers with device file iii. cdev_add() make device entry in sysfs
Select one:
a. only i is correct
b. i and ii are correct
c. i and iii are correct
d. all are correct
Which of the following provides a back trace of the execution in system space with respect
to our methods?
Select one:
a. dump_stack()
b. obj_dump()
c. trace()
d. None of the above
23) Each thread has its own user stack and no kernel stack.
Select one:
a. True b. False
24)Which macros are used to read IO ports directly from Linux driver?
Select one:
a. read()
b. readdir()
c. inb()
d. poll()
27)In the following command, how many jobs will run simultaneously? make -j8 -j4 bzImage
Select one:
a. 8
b. 4
c. 12
d. Both a and b
e. All of the above
28)Select correct option While configuring the kernel, the valid states for a configuration
option are: i. y — the option is enabled. ii. n — the option is not enabled. iii. m — the option
is set to be built as a module.
Select one:
a. Only i and ii
b. Only i and iii
c. i, ii and iii
d. Only ii and iii
29) Which of the following command copies the kernel image from arch/i386/boot/bzImage to
/boot/vmlinuz-version and edits /boot/grub/grub.cfg
Select one:
a. make modules
b. make modules_install
c. make bzImage
d. make install
30)"make modules" compiles all modules and "make modules_install" installs all the compiled
modules to their correct home in /modules.
Select one:
a. True b. False
33) To configure the kernel you can use which of the following command:
Select one:
a. make xconfig
b. make menuconfig
c. make gconfig
d. All of the above
34) Operating system can not kill any thread at any time but a thread can kill any other thread.
Select one:
a. True b. False
5. The file /proc/[PID]/cmdline holds the complete command line for the process, unless the process is
a
a) child process
b) zombie process
c) orphan process
d) none of the mentioned
Explanation: A zombie process is the process which has completed execution but still has an entry in the
process table.
6. What is /proc/[PID]/cwd?
a) symbolic link to current directory of the process
b) regular file containing the information about the current status of the process
c) directory containing various sub-directories
d) none of the mentioned
7. Which one of the following file contains the environment for the process?
a) /proc/[PID]/environ
b) /proc/[PID]/env
c) /proc/[PID]/path
d) none of the mentioned
8. The entry for each file opened by the process is present in
a) /proc/[PID]/fd
b) /proc/[PID]/file
c) /proc/[PID]/maps
d) none of the mentioned
9. The file /proc/[PID]/limits displays the ______ for each of the process’s resource limits.
a) hard limit
b) soft limit
c) units of measurement
d) all of the mentioned
12. “ps” command uses the file _____ to provide the information.
a) /proc/[PID]/stat
b) /proc/[PID]/smaps
c) /proc/[PID]/oom_score_adj
d) /proc/[PID]/oom_score
18. Which file of the proc filesystem can be used instead of “syslog” system call to read kernel messages?
a) /proc/kmsg
b) /proc/moudle/kmsg
c) /proc/module/msg
d) /proc/msg
21. Which one of the following operating system does not supports proc filesystem?
a) IBM AIX
b) QNX
c) Solaries
d) None of the mentioned
23. Which one of the following contains various bits of information about the state of power
management?
a) /proc/acpi
b) /proc/apm
c) both /proc/acpi and /proc/apm
d) none of the mentioned
24. Which file contains the boot options passed to the kernel?
a) /proc/cmdline
b) /proc/root
c) /proc/boot
d) none of the mentioned
25. Which one of the following is a symlink to the root path as seen by the process?
a) /proc/[PID]/root
b) /proc/[PID]/path
c) both /proc/apm and /proc/[PID]/path
d) none of the mentioned
32. Which one of the following command will print the environement of process 1?
a) cat /proc/1/environ
b) cat /proc/bin/1/env
c) cat /proc/1/var/env
d) none of the mentioned
35. Most files and directories within /proc are 0 bytes in size because
a) proc filesystem exists only as a reflection of the in-memory kernel data structure
b) these files contains very only one or two instructions
c) proc filesystem doesn’t exists only as a reflection
d) none of the mentioned
37. Accessing the file /proc/meminfo gives the different result each time because
a) memory usages is always fluctuating
b) a new process id is assigned
c) logical address is different from the physical address
d) none of the mentioned
42. Which file is used primarily for diagnosing memory fragmentation issues ?
a) /proc/buddyinfo
b) /proc/meminfo
c) /proc/apm
d) none of the mentioned
43. Which file shows the parameter passed to kernel at the time of starting?
a) /proc/apm
b) /proc/cmdline
c) both /proc/apm and /proc/cmdline
d) none of the mentioned
44. For the system having one processor, the processor identifying number in the file /proc/cpuinfo is
a) 0
b) 1
c) 2
d) 3
48. The file /proc/locks displays the file currently locked by the
a) kernel
b) user
c) superuser
d) none of the mentioned
49. The file /proc version shows the version of ______ used in the system.
a) kernel
b) gcc
c) both kernel and gcc
d) none of the mentioned
7. Under UNIX the key board is the default input device and the monitor is the default output device
a) True
b) False
25. Which among the following is used to write small programs to control Unix functionalities?
a) Shell Commands
b) Shell Script
c) Filters
d) C Language
26. What control character signals the end of the input file?
a) ctrl + a
b) ctrl + b
c) ctrl + c
d) ctrl + d
10. Which command is used to display the octal value of the text
a) octal
b) text_oct
c) oct
d) od
18. Which option of rm command is used to remove a directory with all its subdirectories
a) –b
b) –o
c) –p
d) –r
22. Which of these commands could you use to show one page of output at a time?
a) less
b) sed
c) pause
d) grep
23. Which commands will give you information about how much disk space each file in the current
directory uses?
a) ls -l
b) ls -la
c) du
d) ls -a
25. Which command is used to display all the files including hidden files in your current and its
subdirectories ?
a) ls –aR
b) ls –a
c) ls –R
d) ls –l
26. Which of the following commands can be used to copy files across systems?
a) ssh
b) telnet
c) rsh
d) ftp
28. Which of the following commands can be used to change default permissions for files and directories
at the time of creation
a) Chmod
b) Chown
c) Umask
d) Chgrp
View Answer
29. Which tar command option is used to list the files in a tape archive format?
a) cvf
b) tvf
c) xvf
d) ovf
30. Which of the following commands will allow the user to search contents of a file for a particular
pattern
a) touch
b) grep
c) find
d) ls
31. Write the command to display the current date in the form dd/mm/yyyy.
a) date +%d/%m/%Y
b) date +”%d/%m/%Y”
c) date +/%d/%m/20%y
32. The command syntax to display the file ‘sample.txt’ one page at a time is
a) man sample.txt>more
b) cat sample.txt<more
c) cat sample.txt|more
d) none of the mentioned
34. How do you add (append) a file “file1” to the example.tar file
a) no you cannot add a file to example.tar
b) tar -cvf example.tar file1
c) tar -rvf file1 example.tar
d) tar -evf file1 example.tar
36. Which command gives the first byte where the difference is in the file1 & file2?
a) diff
b) cmp
c) comm
d) ls -a
39. What communication command provides communication to another user logged on by writing to the
bottom of their terminal?
a) talk
b) write
c) chat
d) transmit
40. Which screen manipulation command sets the screen back to normal?
a) tput cup
b) tput smso
c) tput rmso
d) tput blink
41. Which command will you use to see the available routes?
a) show route
b) route status
c) netstat -r
d) none of the mentioned
1. Which of the following time stamps need not exist for a file on traditional unix file system
a) Access Time
b) Modification Time
c) Creation Time
d) Change Time
View Answer
3. Which option of rmdir command will remove all directories a, b, c if path is a/b/c
a) –b
b) –o
c) –p
d) –t
6. Executing the ‘cd ..’ command when at the root level causes
a) Error message indicating the user can’t access beyond the root level
b) Behavior is unix-flavor dependent
c) Results in changing to the ‘home’ directory
d) Nothing happens
10. Any file’s attribute information is stored in which structure on the disk
a) Inode
b) Data blocks
c) File blocks
d) Directory file
View Answer
11. By default if any regular file is created, the number of link is displayed as 1 ?
a) True
b) False
12. How many links are created when we creat a directory file?
a) 1
b) 2
c) 3
d) 4
13. A user creates a link to a file file1 using the following command “ln file1 file2”. Which of the
following is not true?
a) file1 and file2 have the same inode numbers
b) The number of links for file1 is displayed as 1
c) The number of links for file1 is displayed as 2
d) The number of links for file2 is displayed as 2
14. 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
15. If two files on same partition point to the same inode structure they are called
a) Soft links
b) Hard links
c) Alias
d) Special files
21. What UNIX command is used to update the modification time of a file?
a) time
b) modify
c) cat
d) touch
1. The soft link will increase the link counter of the file.(T/F)
a) True
b) False
3. srwxr-xrw- is a
a) internet socket file
b) unix domain socket file
c) symbolic link
d) shared file
8. If user tries to remove (rm) a readonly file (444 permission), what will happen?
a) The file is removed successfully (and silently)
b) The rm command prompts for a confirmation, the command is successful upon confirmation
c) The rm command prompts for a confirmation, however the operation fails because of insufficient
permissions
d) The rm command fails because of insufficient permissions
10. If the umask value is 0002. what will be the permissions of new directory
a) 777
b) 775
c) 774
d) 664
11. What is the command to set the execute permissions to all the files and subdirectories within the
directory /home/user1/direct
a) chmod –r +x /home/user1/direct
b) chmod –R +x /home/user1/direct
c) chmod –f –r +x /home/user1/direct
d) chmod –F +x /home/user1/direct
13. With a umask value of 112, what is the default permission assigned to newly created regular file?
a) —x–x-wx
b) -rw-rw-r–
c) -r-xr-x-r–
d) -rw-rw-r–
16. Which of these commands will set the permissions on file textfile to read and write for the owner,
read for the group, and nothing for everyone else?
a) chmod 046 textfile
b) chmod 640 textfile
c) chmod 310 textfile
d) chmod rw r nil textfile
17. If you are a root user, how can you grand execute permission only for the owner of the file project1?
a) chmod +x project1
b) chmod u+x project1
c) chmod a+x project1
d) chmod U+X project1
21. Which of the following umask settings allow execute permission to be set by default on regular files
a) 222
b) 111
c) 000
d) None of the mentioned
3. Which filesystem can be used to change certain kernel parameters at runtime using sysctl command?
a) Ext3
b) Sysfs
c) Ext4
d) Procfs
7. ____ is a directory (which should exist), on which to mount the file system?
a) Root
b) Boot
c) Mount-point
d) Partition
9. 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
4. Which command can be executed by a user who is already logged into the system, in order to change
to the root user? (type the command without any parameters)
a) su
b) root
c) chroot
d) user
7. Which of the following values for STAT column of ps command is not true:
a) status R means running
b) Status S means sleeping
c) Status E means exited
d) Status Z means zombie
8. When a child process exits before the parent process exits, which of the following is true:
a) the child process becomes defunct
b) the parent process becomes defunct
c) if the parent process does not handle SIGCHLD, the child process becomes a zombie
d) none of the mentioned
$ 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
10. The signal sent to a process when the Ctrl-C key is pressed is
a) KILL
b) TSTP
c) TERM
d) INT
1. User’s Primary Group id is listed in which file, at the time of creation of the user (On a standard Unix
system)
a) /etc/passwd
b) /etc/groups
c) /etc/login
d) /etc/profile
4. Which of the following identifiers associated with a process decide its privilege level
a) uid
b) suid
c) euid
d) gid
6. User id 0 is
a) An innvalid user id
b) The id of the root user
c) The id of a user when the user’s account is deleted
d) None of the mentioned
7. The login shell is
a) The shell program that runs when the user logs in
b) The shell program that authenticates the user while logging in
c) Common shell for all the users that belong to the same group
d) None of the mentioned
8. Which of the following command can be used to change the user password?
a) user can’t change the password
b) passwd
c) passd
d) pwd
11. Which of the following files need to be referred for user’s secondary group?
a) /etc/passwd
b) /etc/shadow
c) /etc/group
d) /etc/profile
If a user, not belonging to the group ‘root’, runs the passwd executable in an attempt to modify his
password, then which of the following is true?
a) password change fails since user does not have permission to update /etc/passwd file
b) password change is successful because the program runs as root
c) passwd change program runs in kernel mode where write access to the /etc/passwd file is possible
d) /etc/passwd is a special file and the system by default allows all users to update it
View Answer
3. How do you print the lines between 5 and 10, both inclusive
a) cat filename | head | tail -6
b) cat filename | head | tail -5
c) cat filename | tail +5 | head
d) cat filename | tail -5 | head -10
x = 3; y = 5; z = 10;
if [( $x -eq 3 ) -a ( $y -eq 5 -o $z -eq 10 )]
then
echo $x
else
echo $y
fi
a) 1
b) 3
c) 5
d) Error
12. The statement z = ‘expr 5 / 2’ would store which of the following values in z?
a) 0
b) 1
c) 2
d) 2.5
13. To feed standard output of one command to standard input of another in a single shell session
a) IO redirection can be used
b) Named pipes can be used
c) The pipe operator provided by the shell can be used
d) It can not be done
14. Which of the following commands allows definition and assignment of environment variables under
bash
a) env
b) export
c) environ
d) setenviron
21. The user bhojas logged in and performed the following sequence of command. What will be the
output of the last command?
$ cd project/module1
$ pwd
a) /home/bhojas/project/module1
b) /home/project/module1
c) /usr/bhojas/project/module1
d) project/module1
23. Which of the following files will not be displayed by the command cat re* ?
a) reminder
b) receipt
c) Receipt
d) recipe-cake
27. Which of these is the correct method for appending “foo” in /tmp/bar file?
a) echo foo > /tmp/bar
b) echo foo >> /tmp/bar
c) echo foo | /tmp/var
d) /tmp/bar < echo foo
32. From where would the read statement read if the following statements were executed?
exec < file1
exec < file2
exec < file3
read line
a) It would read all the files
b) It would not read any files
c) It would read all the files in reverse order
d) It would read only file3
34. Which variable is used to display number of arguments specified in command line
a) $0
b) $#
c) $*
d) $?
37. * Specifies
a) one or more character
b) zero or more charecter
c) nothing
d) none of the mentioned
38. ? Specifies
a) one or more character
b) zero or more charecter
c) one character
d) none of the mentioned
39. Which of the following file set in the current directory are identified by the regular expression a?b*
a) afcc, aabb
b) aabb, axbc
c) abbb, abxy
d) abcd, axbb
40. What command would send the output of cmd1 to the input of cmd2?
a) cmd1 | cmd2
b) cmd1 || cmd2
c) cmd1 && cmd2
d) cmd1 ; cmd2
41. What is the output of the following command for bash shell:
echo linux $0
a) linux echo
b) linux linux
c) linux bash
d) linux
41. Which variable will display the list of the positional parameters?
a) $#
b) $*
c) $?
d) $$
44. Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a directory, which files match
with the pattern file[ABC]?
a) fileA, fileB and fileABC
b) fileABC
c) fileA and fileB
d) fileAB, fileBC and fileABC
46. Which one is used to select only one copy of the repeated lines?
a) uniq -u
b) uniq -d
c) uniq -c
d) uniq –I
47. Indicate the right option to search for BOB, Bob, BOb or BoB?
a) grep –i Bob files
b) grep ‘B[oO][bB]’ files
c) grep ‘[BOB]’ files
d) grep -v ‘Bob’ files
48. Indicate the right option to search for anything not a letter or number
a) grep ‘^[a-zA-Z0-9]’
b) grep ‘[^a-zA-Z0-9]’
c) grep ‘[a-zA-Z0-9]’
d) None of the mentioned
49. How do you remove duplicate lines from the file foo using uniq?
a) sort foo | uniq –u
b) sort -u foo | uniq -d
c) sort foo | uniq –c
d) sort foo | uniq –I
52. What is the command that can print lines of first file matching with second file?
a) printline
b) cmp
c) com
d) comm
53. Which character to use to escape meaning of special characters in search operations?
a) []
b) ^
c) .
d) backslash (\)
55. Which expression use the value of the enclosed arithmetic expression?
a) $(())
b) $()
c) ${}
d) $[].
58. Which one of the following is not a valid operator in bash shell?
a) ||
b) ~
c) =<<
d) -=
#!/bin/bash
a=2
b=4
let c=a**b
echo $c
exit 0
a) 8
b) 16
c) 32
d) none of the mentioned
64. Which command runs the shell built-in command ‘command’ with the given argument?
a) builtin
b) caller
c) there is no command present for this purpose
d) none of the mentioned
65. Which option of the command ‘cd’ use the actual filesystem path for cd.. and the value of pwd?
a) -l
b) -L
c) -p
d) -P
67. Which command generates possible completions for string according to the and write it to standard
output?
a) compgen
b) complete
c) continue
d) none of the mentioned
68. Which command executes ‘command’ in place of the current process instead of creating a new
process?
a) exec
b) command
c) trap
d) none of the mentioned
5. Which command is used to delete the character before the cursor location in vi editor?
a) X
b) x
c) D
d) d
Explanation: The command ‘x’ is used to delete the character under the cursor locarion.
1. The major number identifies the _____ associated with the device.
a) driver
b) protocol
c) port
d) none of the mentioned
a) driver
b) major number
c) 256 character drivers and 256 block drivers at the same time
4. 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
#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]#
6. 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().
#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
#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]#
#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]#
#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
11. 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]#
#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
#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
c) 0 to 255
16. 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
18. 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
2. Hard drives are divided into separate storage spaces called ___.
a) Buffer
b) Cache
c) Partitions
d) VFS
Ans. c) Partitions
3. The Preferences menus on GNOME and KDE exhibit similar desktop configuration tools.
(True/False)
Ans. False. The Preferences menus on GNOME and KDE exhibit different variety of desktop
configuration tools.
4. ___ provides fundamental window functions and skins for a configurable appearance and feel.
Ans. Metacity
5. KDE (K Desktop Environment) is written in C++ and developed on the ___ library.
Ans. Qt toolkit
6. The X Window system was the outcome of research attempts in the early 1980s at Stanford
University and MIT, assisted by IBM, to create a ___ protocol.
Ans. Platform-independent graphics
7. The window may be a ___ where the user executes standard Unix commands or X client
applications such as a web browser, xcalc calculator, or an Emacs session.
Ans. Terminal window
10. Although it is possible to create and edit the configuration file directly, it is preferable to use the
distribution’s display configuration tool. (True/False)
Ans. True
11. The window manager program handles user logins and provides authentication and beginning
sessions. (True/False)
Ans. False. The X Display manager program handles user logins and provides authentication and
beginning sessions.
12. An original window manager that does not share code with others is ___.
Ans. Blackbox
13. Files like ___ configure how the dialog box is displayed, and ___ helps the user to indicate a root-
window image or other windows to display.
Ans. Xresources and Xsetup
14. Widgets are designed to work independently of the application except through precise interactions,
called as ___ functions.
Ans. Callback
15. A recent, full-featured widget library that has developed as an industry standard is X Toolkit.
(True/False)
Ans. False. A recent, full-featured widget library that has developed as an industry standard is Motif.
16. Tk (tee-kay, libtk.so) is a library that is mainly applied with the ___ language.
Ans. Tcl scripting
17. Identify the widget set that offers a simple choice of basic user interaction components?
a) GTK+
b) Qt
c) LessTif
d) Athena
Ans. d) Athena
18. The RPM packages with source codes will have an extension of ___.
a) .gz
b) .tgz
c) .src.rpm
d) .tar
Ans. c) .src.rpm
19. The process of connecting a file system to a particular directory in order to access files on a storage
device is called ___.
Ans. Mounting the file system
20. The Linux software packages provide all the files required for installing an application in different
___.
Ans. Modules
21. Any Web browser can behave like an FTP client but such programs are suitable for ___ FTP
downloads.
Ans. Anonymous
23. The distributions like Debian and Ubuntu are provided with the___ service.
Ans. Blackdown
24. The safest way to use JPackage is to download its Java 2 Software Development Kit repository
configuration file. (True/False)
Ans. False. The safest way to use JPackage is to download its Yellowdog Updater, Modified (YUM)
repository configuration file.
25. Web browsers are used instead of mail clients to access the services provided by the Web-based
Internet mail services. (True/False)
Ans. True
26. Generally, the digital signature is appended at the ___ of the message.
Ans. End
28. Proxies help to control access to some services such as the Web or FTP servers. (True/False)
Ans. True
29. The EncFS uses the ___ library and Linux kernel module to create the filesystem interface.
Ans. FUSE
30. The ___ command helps you to maintain packages, query them, create your own, and verify the
packages which you have.
Ans. rpm
31. Identify the software package that helps to install Microsoft Office applications in the Linux
system.
a) CrossOver Office
b) Informix
c) GNU SQL
d) MySQL
Ans. CrossOver Office
36. The graphical software package used to display PostScript files or PDF documents is GGv.
(True/False)
Ans. True
37. Linux news clients allow reading newsgroup postings, either in___ or ___ mode.
Ans. Graphically, Text
40. The ___ command can be used to display contents present in directories.
a. ls
b. ps
c. cd
d. pwd
Ans. a
41. Identify the shell command used to create or list command shortcuts.
a. HISTFILE
b. History
c. Alias
d. Export
Ans. c
42. Which of the following set built-in command is used to read commands but not to execute them?
a. set -m
b. set –n
c. set -t
d. set -h
Ans. b
43. The ___ variable indicates the user’s current working directory.
a. PATH
b. CDPATH
c. HOME
d. PWD
Ans. d
45. A ___ is a special program that can control a specific type of hardware.
A) Shell
B) Device driver
C) Complier
D) Database
Ans. b
46. ___ is a computer program that translates source code to object code.
A) Translator
B) Boot loader
C) Compiler
D) Interpreter
Ans. c
47. ___ directory has system configuration files, network configuration files, application configuration
files and other installed software.
A) /var
B) /mnt
C) /opt
D) /etc
Ans. c
48. ___ is an open-source Unix shell that is embedded within the Scheme programming language.
A) csh
B) ksh
C) scsh
D) tcsh
Ans. c
49. Which among the following is the command that displays advanced file attributes? .
A) lsattr
B) mkdir
C) chattr
D) lpr
Ans. a
50. Name the init level which represents the Single user mode with networking. .
A) 0
B) 3
C) 6
D) 2
Ans. d
51. The ___ of GNOME’s user admin tool helps to define the user account settings. .
A) Advanced panel
B) User privileges
C) Account properties
D) New user accounts
Ans. a
52. The tree structure of the Linux file system may vary based on the ___
A) System user
B) Hardware devices
C) System directories
D) System administrator
Ans. d
54. Hard drives are divided into separate storage spaces called ___.
A) Buffer
B) Cache
C) Partitions
D) VFS
Ans. c
55. All the partitions are usually connected to the system through the ___
A) Mount point
B) Directories
C) Links
D) File system
Ans. a
56. To read in a new file starting at the present location, the ___ command is used.
A) :q
B) :wq
C) :r
D) :q!
Ans. c
58. ___ command is used to read the sed command from the sed script file.
A) -e
B) -f
C) -n
D) e
Ans. b
59. Identify the widget set that offers a simple choice of basic user interaction components?
A) GTK+
B) Qt
C) LessTif
D) Athena
Ans. d
60. Xorg applications and servers are installed in the ___ directory.
A) /usr/X11R6/lib
B) /usr/bin
C) /usr/include/x11
D) /usr/share/x11
Ans. b
61. Which among the following is the system variable that indicates the name of the user’s computer?
A) BASH_VERSION
B) HOSTNAME
C) CDPATH
D) HISTFILE
Ans. b
62. ___ is an online description of an interactive shell command, system interface, or system object.
A) Manpage
B) NAT
C) PTP
D) SSL
Ans. a
63. Which of the following tools allow modifying the existing images?
A) Display
B) Creation
C) Manipulate
D) Conversion
Ans. c
64. ___ directory includes Kernel, Firmware, and system-related files and ___ the directory contains
system commands and programs called binaries that are needed during bootup.
A) /sys and /bin
B) /boot and /sbin
C) /bin and /sbin
D) /lib and /mnt
Ans. a
65. ___ refers to the configuration of the partition and ___ refers to the hard drive device that is
mounted.
A) Partition, format
B) Format, partition
C) Directory,partition
D) Format,directory
Ans. b
66. Files like ____ configure how the dialog box is displayed, and _____ helps the user to indicate a
root-window image or other windows to display.
A) Xresources and Xsetup
B) Xstartup and Xresource
C) .xsession and .Xauthority
D) Xsetup and Xdm-config
Ans. a
67. Linux news clients allow reading newsgroup postings, either in ____ or _____ mode.
A) Graphically, Text
B) Graphically, sound
C) Text,sound
D) Video, sound
Ans. a
68. The EncFS uses the ____ library and Linux kernel module to create the filesystem interface.
A) FUSE
B) End
C) Module
D) Xbase
Ans. a
69. ____ is the process in which a network device like a firewall assigns a public address to a system
inside a private network.
A) Network Address Translation
B) Mandatory Access Control
C) Daemon
D) Manpage
Ans. a
70. When a system is running in full multiuser with networking mode, in which of the following run
levels is the system running?
a. Runlevel 1
b. Runlevel 2
c. Runlevel 0
d. Runlevel 3
Ans. d
71. For better security, passwords are now stored in the ___ file and only the root user can access this
file.
a. /etc/shadow
b. /etc/passwd
c. /etc/group
d. /etc/bash.bashrc
Ans. a
72. An application program accesses the module’s services with the help of ___ function.
a. cleanup_module()
b. module_ init()
c. module_exit()
d. printk()
Ans. b
73. The ___ command is used to display information about the partitions and their mount point.
a. cat
b. df
c. cd
d. ps
Ans. b
74. Which of the following is a startup script for the user session?
a. .xsession
b. Xstartup
c. Xsession
d. Xreset
Ans. c
78. The Debian based Linux systems use a package management system that is based on a tool called
___.
a. RPM
b. dpkg
c. YUM
d. Portage
Ans. b
none of these
2.
In sysfs.h which one of the following structure represents the directory entries?
struct sysfs_dirent
3.
The name pointer of the attribute data structure represents the _____ in sysfs.
A.) directory
B.) file
C.) symbolic link
D.) none of these
Answer: Option 'B'
File
1.
Relationship between components of device driver models are expressed in the sysfs as
A.) a directory
B.) a regular file
C.) symbolic links between files and directories
D.) none of these
Answer: Option 'C'
2.
What is the main role of the regular files in the sysfs?
3.
The core data structure of device driver model is
A.) kobject
B.) kfile
C.) kmodule
D.) none of these
Answer: Option 'A'
kobject
4.
The kset contains
all of these
5.
Which one of the following is a read-write semaphore in linux that protects all ksets and kobjects
included in the filesystem?
A.) rwsem
B.) rwsemaphore
C.) rws
D.) none of these
Answer: Option 'A'
rwsem
6.
Each device in the device driver model is represented by a _____ object.
A.) driver
B.) device
C.) node
D.) none of these
Answer: Option 'B'
device
7.
Each driver in the device driver model is described by a ______ object.
A.) dev_d
B.) device_d
C.) dev_driver
D.) device_driver
Answer: Option 'D'
device_driver
8.
The channel between the processor and devices is called?
A.) bus
B.) driver
C.) class
D.) none of these
Answer: Option 'A'
bus
9.
In which directory every kernel module of the system is represented?
A.) /sys/kernel
B.) /sys/module
C.) /sys/kernel/module
D.) none of these
Answer: Option 'C'
/sys/kernel/module
10.
In sysfs the device drivers of same _____ are expected to provide same functionalities to the user mode
application.
A.) class
B.) kobjects
C.) ksets
D.) none of these
Answer: Option 'A'
Class
1.
Sysfs is initialised in ______ file via sysfs_init function.
A.) fs/sysfs/mount.c
B.) sysfs/mount.c
C.) fs/mount.c
D.) none of these
Answer: Option 'A'
fs/sysfs/mount.c
2.
Kernel objects are exported as _____ via sysfs.
directories
3.
Sysfs internally stores the pointer to the ____ that implements the directory in the file system.
A.) kobjects
B.) kstructures
C.) kinodes
D.) none of these
Answer: Option 'A'
kobjects
4.
Attributes can be exported for objects in the form of _______ in the file system.
regular files
5.
In sysfs every subsystem has
6.
sysfs is based on
A.) rootfs
B.) ramfs
C.) initramfs
D.) none of these
Answer: Option 'B'
ramfs
7.
Which one of the following is a notification to user space from the kernel that something has changed
in the system’s configuration?
hotplug event
8.
In the device driver model the device_driver object contains the
A.) name of the device driver
B.) embedded kobjects
C.) method for probing a device
D.) all of these
Answer: Option 'D'
all of these
9.
A ____ is a higher level view of a device that abstracts out low level implementation details/
A.) inode
B.) class
C.) major number
D.) minor number
Answer: Option 'B'
class
10.
When a device is removed from the system
A.) files and directories of that device in the sysfs are removed automatically
B.) all the files of sysfs are preserved until the system turn offs
C.) it does not create any change in the sysfs
D.) none of these
Answer: Option 'A'
files and directories of that device in the sysfs are removed automatically
A.) are created at system startup when the subsystems register themselves with kobject core
B.) are created when any device is connects with the system
C.) are created at the time of kernel compilation
D.) none of these
Answer: Option 'A'
are created at system startup when the subsystems register themselves with kobject core
2.
The directory /sys/block contains
3.
In sysfs, each represented bus type has two directories named as
4.
A device class describes the ____ type of device.
A.) physical
B.) stuctural
C.) functional
D.) none of these
Answer: Option 'C'
functional
5.
Which one of the following directory contains every physical device that has been discovered by the
bus types registered with the kernel?
A.) /sys/devices
B.) /sys/bus/devices
C.) /devices
D.) none of these
Answer: Option 'A'
/sys/devices
6.
Which type of devices are peripheral devices?
system devices
7.
Which one of the following is not a system device?
A.) CPU
B.) APIC
C.) Timer
D.) None of these
Answer: Option 'D'
None of these
8.
Which one of the following is not a platform specific code?
A.) x86 BIOS
B.) EFI on ia64
C.) both x86 BIOS and EFI on ia64
D.) none of these
Answer: Option 'D'
none of these
9.
In device driver model bus_type object contains the
all of these
10.
The file fs/sysfs/sysfs.h contains the
1.
Sysfs was originally called
2.
What is sysfs?
all of these
3.
Sysfs can be considered as the reflection of the
4.
The files of sysfs contains the information about
6.
In linux sysfs is always mounted at
A.) /sys
B.) /proc/sys
C.) /proc/mounts
D.) none of these
Answer: Option 'A'
/sys
7.
Libsysfs is a
8.
Sysfs represents the
A.) kernel objects
B.) libraries
C.) api
D.) none of these
Answer: Option 'A'
kernel objects
9.
Sysfs does not contains
none of these
10.
The directories in the /sys directory represents
LDD MCQ
1. The major number identifies the associated with the device.
a) driver
b) protocol
c) port
d) none of the mentioned
5. 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
7. The connection between the device file and device driver is based on the
a) name of device file
b) number of device file
c) name & number of device file
d) none of the mentioned
8. In linux kernel 2.1, the minor numbers were used to
a) represent the sub-functionalities of the driver
b) identify the driver
c) represent the device files
d) none of the mentioned
17. Libsysfs is a
a) user space library
b) kernel space library
c) not a library
d) none of the mentioned
23. In sysfs, each represented bus type has two directories named as
a) attributes and kobjects
b) devices and drivers
c) devices and kobjects
d) none of the mentioned
25. Which one of the following directory contains every physical device that has been
discovered by the bus types registered with the kernel?
a) /sys/devices
b) /sys/bus/devices
c) /devices
d) none of the mentioned
33. Sysfs internally stores the pointer to the that implements the directory in the
file system.
a) kobjects
b) kstructures
c) kinodes
d) none of the mentioned
34. Attributes can be exported for objects in the form of in the file system.
a) regular files
b) directories
c) symbolic links
d) none of the mentioned
37. Which one of the following is a notification to user space from the kernel that
something has changed in the system’s configuration?
a) hotplug event
b) module event
c) attach event
d) none of the mentioned
38. In the device driver model the device_driver object contains the
a) name of the device driver
b) embedded kobjects
c) method for probing a device
d) all of the mentioned
39. A is a higher level view of a device that abstracts out low level
implementation details/
a) inode
b) class
c) major number
d) minor number
41. Relationship between components of device driver models are expressed in the
sysfs as
a) a directory
b) a regular file
c) symbolic links between files and directories
d) none of the mentioned
42. What is the main role of the regular files in the sysfs?
a) regular files represent the attributes of devices and drivers
b) regular files represent the kernel objects
c) regular files represent the kernel sets
d) none of the mentioned
43. The core data structure of device driver model is
a) kobject
b) kfile
c) kmodule
d) none of the mentioned
45. Which one of the following is a read-write semaphore in linux that protects all
ksets and kobjects included in the filesystem?
a) rwsem
b) rwsemaphore
c) rws
d) none of the mentioned
52. Which of the following verifies that user space buffer can be read/write in kernel
space code?
a) copy_from_user()
b) copy_to_user()
c) access_ok()
d) None of these
59. All the details about the module like author, version etc can be viewed by using
utility
a) lsmod
b) modprobe
c) dmesg
d) modinfo
60. which function is used to allocated memory for buffer of the USB.
a) usb_alloc_buffer()
b) usb_buffer_alloc()
c) usb_alloc()
d) usb_alloc_urb()
63. which macro is used to add kernel module functions to kernel symbol
table?select one:
a) MODULE_EXPORT()
b) EXPORT_SYMBOL()
c) EXPORT_KERNEL()
d) EXPORT_FUNCTION()
64. "kernel is tained" message will be produced when the module is inserted
without
a) MODULE_LICENSE
b) MODULE_AUTHOR
c) MODULE_VERSION
d) MODULE_DESCRIPTION
65. In the device driver model the device_driver object contains the
a) name of the device driver
b) embedded kobjects
c) method for probing a device
d) all of the mentioned
68. which of the following function is use to wake up a task from wait queue in case
of spinlock?
a) wake_up(&wq)
b) wake_up_interruptible
c) wake_spinlock(&wq)
d) none of the above
74. 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
76. which of the following bottom half mechanism can sleep or can be scheduled?
a) softirq
b) tasklet
c) work queue
d) None of the above
77. 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();
78. 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
79. 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>