InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following system call uses file descriptor as an argument?(a) read(b) write(c) close(d) read, write, closeI have been asked this question in quiz.Question is from File Handling System Calls in chapter System Programming I – Files of Unix |
|
Answer» Right answer is (d) read, write, close |
|
| 2. |
System calls and library functions are same.(a) True(b) FalseThis question was addressed to me at a job interview.I'm obligated to ask this question of File Handling System Calls in portion System Programming I – Files of Unix |
|
Answer» The correct choice is (b) False |
|
| 3. |
For changing the time stamps, _____ system call is invoked.(a) atime(b) utime(c) mtime(d) chI got this question in an online quiz.The doubt is from File Handling System Calls in section System Programming I – Files of Unix |
|
Answer» Correct option is (b) utime |
|
| 4. |
chmod and fchmod calls are used for changing file permissions.(a) True(b) FalseThis question was addressed to me in an internship interview.Enquiry is from File Handling System Calls in portion System Programming I – Files of Unix |
|
Answer» Right answer is (a) True |
|
| 5. |
Both the owner and group owner can be changed by ____ call.(a) chown(b) chgrp(c) chuser(d) chI had been asked this question in class test.This question is from File Handling System Calls in portion System Programming I – Files of Unix |
|
Answer» RIGHT answer is (a) CHOWN Easy explanation: The chown SYSTEM call is used to CHANGE both the owner and group owner. It has three STATES; chown, fchown, lchown. |
|
| 6. |
Which of the following is used with access call for checking the owner’s permissions?(a) R_OK(b) W_OK(c) X_OK(d) R_OK, W_OK, X_OKThis question was addressed to me in an internship interview.I want to ask this question from File Handling System Calls topic in section System Programming I – Files of Unix |
|
Answer» Right choice is (d) R_OK, W_OK, X_OK |
|
| 7. |
For checking a file access rights, ___ system call is used.(a) acc(b) access(c) axs(d) filertThis question was posed to me in an interview for internship.My question is from File Handling System Calls in chapter System Programming I – Files of Unix |
|
Answer» CORRECT choice is (B) access To explain I would SAY: By using the access SYSTEM call, we can check the file’s access rights. It looks at the real UID and real GID of the user running the program and determines that WHETHER the file is accessible by the real user. |
|
| 8. |
Which of the following macro returns true if the file type is a directory?(a) S_ISREG(b) S_ISDIR(c) S_ISCHR(d) S_ISFIFOThis question was addressed to me during an interview.The origin of the question is File Handling System Calls topic in chapter System Programming I – Files of Unix |
|
Answer» Right option is (B) S_ISDIR |
|
| 9. |
S_IFxxx macros are used for checking the file types.(a) True(b) FalseI have been asked this question in unit test.The question is from File Handling System Calls topic in portion System Programming I – Files of Unix |
|
Answer» Correct choice is (a) True |
|
| 10. |
____ system call is used for renaming a file, directory or symbolic link.(a) renam(b) rename(c) ren(d) changeThis question was addressed to me by my college professor while I was bunking the class.The doubt is from File Handling System Calls topic in division System Programming I – Files of Unix |
|
Answer» Correct CHOICE is (b) rename |
|
| 11. |
For removing a link, ____ is used.(a) link(b) symlink(c) unlink(d) delinkThe question was asked during an internship interview.This is a very interesting question from File handling System Calls topic in chapter System Programming I – Files of Unix |
|
Answer» Right choice is (c) unlink |
|
| 12. |
For creating a hard and symbolic link, which system calls are used?(a) link, unlink(b) link, symlink(c) unlink, ulink(d) hlink, slinkThe question was asked by my school principal while I was bunking the class.My question is from File handling System Calls in division System Programming I – Files of Unix |
|
Answer» Correct option is (B) link, symlink |
|
| 13. |
A super user can use ___ call for creating a directory.(a) mknod(b) mkdr(c) rmdir(d) chdirI got this question during an interview.My question is based upon File handling System Calls topic in portion System Programming I – Files of Unix |
|
Answer» Right CHOICE is (a) MKNOD |
|
| 14. |
Directories can also be opened, read and written in the same way as regular files.(a) True(b) FalseThis question was addressed to me in my homework.This interesting question is from File handling System Calls in section System Programming I – Files of Unix |
|
Answer» The correct OPTION is (a) True |
|
| 15. |
For creating and removing directories, which of the following system calls are used?(a) mkdir(b) rmdir(c) chdir(d) mkdir and rmdirThis question was addressed to me in a job interview.My enquiry is from File handling System Calls topic in division System Programming I – Files of Unix |
|
Answer» Correct answer is (d) mkdir and rmdir |
|
| 16. |
Which of the following system calls performs the action of cd command?(a) chdir(b) fchdir(c) mkdir(d) chdir and fchdirThis question was addressed to me at a job interview.This interesting question is from File handling System Calls topic in chapter System Programming I – Files of Unix |
|
Answer» Right option is (d) chdir and fchdir |
|
| 17. |
The vnode table is also called _____(a) inode table(b) file table(c) vtable(d) vttableThe question was posed to me in quiz.The doubt is from File handling System Calls topic in portion System Programming I – Files of Unix |
|
Answer» The correct choice is (a) INODE table |
|
| 18. |
The file table contains _________(a) mode of opening(b) status flags(c) offset pointer, reference count(d) mode of opening, status flags, offset printer and reference countThis question was posed to me in an online interview.Enquiry is from File handling System Calls in section System Programming I – Files of Unix |
|
Answer» Correct answer is (d) mode of opening, STATUS flags, offset printer and REFERENCE count |
|
| 19. |
How many data structures does the kernel maintain in memory that contain information about an open file?(a) 3(b) 2(c) 5(d) 1I had been asked this question in unit test.I need to ask this question from File handling System Calls topic in portion System Programming I – Files of Unix |
|
Answer» RIGHT choice is (a) 3 Easiest explanation: The kernel maintains THREE data structures in memory that contain all INFORMATION about an open FILE that a PROCESS needs to access. These data structures are: The file descriptor table The file table The vnode table |
|
| 20. |
The file descriptor table contains all file descriptors for a process.(a) True(b) FalseI have been asked this question during an interview for a job.Question is from File handling System Calls topic in division System Programming I – Files of Unix |
|
Answer» Correct choice is (a) True |
|
| 21. |
Which of the following is not a valid symbolic constant?(a) EPERM(b) ENDENT(c) EIOR(d) EEXISTI have been asked this question in semester exam.I want to ask this question from File handling System Calls in section System Programming I – Files of Unix |
|
Answer» Right OPTION is (c) EIOR |
|
| 22. |
What is the symbolic constant for errno 2?(a) EPERM(b) ENDENT(c) EIO(d) EEXISTThis question was addressed to me at a job interview.The origin of the question is File handling System Calls in division System Programming I – Files of Unix |
|
Answer» Correct choice is (b) ENDENT |
|
| 23. |
What is the significance of errno 13?(a) not a super user(b) no such file and directory(c) permission denied(d) no space left on deviceI got this question by my college professor while I was bunking the class.Enquiry is from File handling System Calls topic in division System Programming I – Files of Unix |
|
Answer» The correct answer is (B) no such FILE and directory |
|
| 24. |
perror also uses error number to print the error messages.(a) True(b) FalseThis question was posed to me in examination.This intriguing question originated from File handling System Calls in portion System Programming I – Files of Unix |
|
Answer» CORRECT answer is (b) False Explanation: There is another library FUNCTION, PERROR which is used for PRINTING the error messages. But perror doesn’t use the errno (error number) as an argument. |
|
| 25. |
Which library function is used for printing error messages?(a) strerror(b) stderror(c) strer(d) ptrerrorThis question was addressed to me during an interview.I need to ask this question from File handling System Calls in section System Programming I – Files of Unix |
|
Answer» The CORRECT option is (a) strerror |
|
| 26. |
truncate needs the ___ of the file as an argument but ftruncate works with _______(a) pathname, file descriptor(b) file descriptor, pathname(c) pathname, pathname(d) file descriptor, file descriptorI got this question in a national level competition.Asked question is from System Calls Basics in section System Programming I – Files of Unix |
|
Answer» Correct option is (a) pathname, file descriptor |
|
| 27. |
Which of the following system call is used for truncating a file?(a) truncate(b) ftruncate(c) trunk(d) truncate and ftruncateI had been asked this question by my school principal while I was bunking the class.My question is taken from System Calls Basics topic in portion System Programming I – Files of Unix |
|
Answer» Right choice is (d) truncate and ftruncate |
|
| 28. |
Which of the following offset is used with lseek system call to set the offset pointer to the end of the file?(a) SEEK_SET(b) SEEK_END(c) SEEK_CUR(d) SEEK_CRThe question was asked in a national level competition.The query is from System Calls Basics topic in section System Programming I – Files of Unix |
|
Answer» Correct CHOICE is (b) SEEK_END |
|
| 29. |
____ system call is used for positioning the offset pointer.(a) read(b) write(c) open(d) lseekThis question was posed to me by my college director while I was bunking the class.This is a very interesting question from System Calls Basics topic in portion System Programming I – Files of Unix |
|
Answer» Right answer is (d) lseek |
|
| 30. |
write system call returns -1 when ___________(a) if disk fills up while write is in progress(b) when file doesn’t exist(c) if the file size exceeds the system’s limit(d) if disk fills up while write is in progress and if the file size exceedsI had been asked this question in an interview for job.My question comes from System Calls Basics topic in chapter System Programming I – Files of Unix |
|
Answer» The CORRECT choice is (d) if disk fills up while WRITE is in progress and if the file size EXCEEDS |
|
| 31. |
____ system call is used for writing to a file.(a) read(b) write(c) close(d) seekThis question was posed to me in an internship interview.My enquiry is from System Calls Basics topic in section System Programming I – Files of Unix |
|
Answer» Correct option is (B) write |
|
| 32. |
close system call returns ____(a) 0(b) -1(c) 1(d) 0 and -1This question was posed to me in a job interview.Query is from System Calls Basics in chapter System Programming I – Files of Unix |
|
Answer» CORRECT CHOICE is (d) 0 and -1 The best I can explain: The return TYPE of close system CALL is an INTEGER. It either returns 0 if the file is closed successfully or -1 otherwise. |
|
| 33. |
Which of the following system call is used for closing a file?(a) open(b) lseek(c) close(d) writeI have been asked this question in an online interview.The query is from System Calls Basics in portion System Programming I – Files of Unix |
|
Answer» Correct option is (c) CLOSE |
|
| 34. |
open system call returns the file descriptor as ___(a) int(b) float(c) char(d) doubleI have been asked this question in a national level competition.I need to ask this question from System Calls Basics topic in chapter System Programming I – Files of Unix |
|
Answer» The correct answer is (c) char |
|
| 35. |
Which of the following mode is used for opening a file in both reading and writing?(a) O_RDONLY(b) O_WRONLY(c) O_RDWR(d) O_WDRThis question was addressed to me in an international level competition.Question is from System Calls Basics in chapter System Programming I – Files of Unix |
|
Answer» CORRECT answer is (c) O_RDWR The explanation is: There are THREE modes of opening a FILE namely: |
|
| 36. |
Which of the following system call is used for opening or creating a file?(a) read(b) write(c) open(d) closeThe question was posed to me in an interview.I need to ask this question from System Calls Basics topic in portion System Programming I – Files of Unix |
|
Answer» The correct ANSWER is (C) open |
|
| 37. |
There are ___ modes of opening a file.(a) 4(b) 3(c) 2(d) 1I got this question during an interview.Enquiry is from System Calls Basics topic in chapter System Programming I – Files of Unix |
|
Answer» Right option is (b) 3 |
|
| 38. |
For reading input, which of the following system call is used?(a) write(b) rd(c) read(d) changeI have been asked this question by my college director while I was bunking the class.My question is taken from System Calls Basics in division System Programming I – Files of Unix |
|
Answer» Correct answer is (c) read |
|
| 39. |
The chmod command invokes the ____ system call.(a) chmod(b) ch(c) read(d) changeI got this question in an online quiz.Question is from System Calls Basics topic in section System Programming I – Files of Unix |
|
Answer» Correct option is (a) CHMOD |
|
| 40. |
All UNIX and LINUX systems have one thing in common which is ____(a) set of system calls(b) set of commands(c) set of instructions(d) set of text editorsI have been asked this question during an online exam.My doubt is from System Calls Basics in portion System Programming I – Files of Unix |
|
Answer» Correct answer is (a) SET of system CALLS |
|
| 41. |
In ____ mode, the kernel runs on behalf of the user.(a) user(b) kernel(c) real(d) allThis question was addressed to me at a job interview.I want to ask this question from System Calls Basics topic in section System Programming I – Files of Unix |
|
Answer» RIGHT option is (b) kernel The EXPLANATION: Whenever a process invokes a SYSTEM call, the CPU switches from user mode to kernel mode which is a more privileged mode. The kernel mode is also called as supervisor mode. In this mode, the kernel RUNS on BEHALF of the user and has access to any memory location and can execute any machine instruction. |
|
| 42. |
When we execute a C program, CPU runs in ____ mode.(a) user(b) kernel(c) supervisory(d) systemI had been asked this question by my school teacher while I was bunking the class.I would like to ask this question from System Calls Basics topic in portion System Programming I – Files of Unix |
|
Answer» Correct answer is (a) user |
|
| 43. |
A system call is a routine built into the kernel and performs a basic function.(a) True(b) FalseThis question was posed to me in an interview for internship.This question is from System Calls Basics in chapter System Programming I – Files of Unix |
|
Answer» CORRECT choice is (a) True For explanation: All UNIX systems offer around 200 special FUNCTIONS known as system calls. A system call is a routine built into the kernel and performs a very basic function that requires communication with the CPU, memory and devices. |
|