Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Device DriversLinux MakefileLinux OS ManagementLinux EnvironmentLinux OS Interviews Quizzes

Accounting

AccountingAccounts PayableAuditJunior AccountantSenior Accountant

Arts

Art DirectorAstrologistInternational RelationshipSociologyVisual Arts

Business and Economy

Accounts Receivable (AR)EconomicsGeneral LedgerPurchasing OfficerTaxation

CMS (Content Management System)

CMSDrupaleZ PublishJoomlaWordPress

Community

Cable OperatorFirefighter SpecialistFuneral DirectorSpeech PathologistTranslator

Engineering

Automobile EngineeringChemical EngineeringCivil EngineeringElectrical EngineeringMechanical Engineering

Management

Administrative OfficerGood Team LeaderHotel ManagementProject CoordinatorStore Keeper

Multimedia

3D AnimationCoreldrawDesign EngineerGraphics DesignerInterior Design

Accounting

Accounting ManagementBank Probationary Officer (PO)Financial Accounting Exam MCQs

Civil Engineering

Building ConstructionRailwaysRCC Structures DesignSoil Mechanics and Foundation EngineeringSurveying

Database

Data Interpretation DatabaseData-mining DatabaseSQL ServerSQL Server DBAWindow Server 2003

Engineering

Electrical EngineeringElectronic DevicesElectronics EngineeringEngineering MechanicsSoftware Engineering

General Knowledge (GK)

General Knowledge (GK)IQ (Intelligence Quotient)Permutation And CombinationPhysical CommunicationVocabulary

Information Technology (IT)

Basics of ComputerComputer KnowledgeComputer OrganizationFundamentals Of ComputerWireless Communication

Networking

Advanced NetworkingBasic NetworkingComputer Networks TestNetwork SecurityNetworking

Linux OS Interviews

Awk Programming IQBash Arithmetic Expressions IQDevice Drivers IQGCC Compiler IQLinux Administrator IQLinux Commands IQLinux Debugging IQLinux Environment IQLinux General IQLinux IPC IQLinux Makefile IQLinux OS IQLinux OS Editors IQLinux OS Management IQLinux OS Shell IQLinux Proc Filesystem IQLinux Search Pattern IQLinux Shared & Static Libraries IQLinux Socket Programming IQLinux Startup and Shutdown IQLinux Sysfs IQLinux Systems IQLinux Threads IQLinux Ubuntu IQSignal Handling IQSystem Calls IQ

Top Linux OS Management Interview Questions & Answers:

Download Interview PDF

1. For the below mentioned code:

int main() {
int fd;
fd = open("logfile", O_CREAT|O_RDWR, 0600);
lseek(fd, 5, SEEK_CUR);
write(fd, "Hello", 5);
return 0;
}

What is the logfile size now if it's initially was 1024 bytes?

a) 5
b) 1024
c) 1029
d) 1034

b) 1024

2. Code snippets

str1="45678n"
str2="123n"
f1 = fopen(file1,RDWR,RWX)
f2 = dup(f1)
write(f1,str1,len_str1)
write(f2,str2,len_str2)

o/p:

a) 12378
b) 123(newline)8(newline)
c) 123(newline)78(newline)
d) 45678(newline)123(newline)

d) 45678(newline)123(newline)

3. Code snippet (file1 size is 2024)

f1 = fopen (file1, RDWR, RWX)
lseek(f1,1024,SEEK_SET)
write(f1,buf,10)
What is offset now.

a) 1024
b) 1034
c) 2034
d) 2054

b) 1034

4. Code snippets

str1="45678n"
str2="123n"
f1 = fopen(file1,RDWR,RWX)
f2 = fopen(file1,RDWR,RWX)
write(f1,str1,len_str1)
write(f2,str2,len_str2)

o/p:

a) 12378
b) 123(newline)8(newline)
c) 123(newline)78(newline)
d) 45678(newline)123(newline)

b) 123(newline)8(newline)

5. What is stored in logfile as per below mentioned code if we execute ./a.out > logfile?

int main() {
int fd;
close(1);
fd = open("logfile",O_RDWR, 0744);
write(fd, "Hello", 5);
printf("Worldn");
return 0;
}

a) Hello
b) HelloWorld
c) World
d) None

b) HelloWorld

6. Given a code snippet below?

#define PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
int main() {
int fd1, fd2;
umask(0);
fd1 = open("file1", O_CREAT | O_RDWR, PERMS)
umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
fd2 = open("file2", O_CREAT | O_RDWR, PERMS)
return 0;
}

The newly created files file1 and file2 will have the permissions respectively
a) rw-rw-rw- r---
b) r--- rw-rw-rw-
c) rw-rw-rw- rw---
d) None of the above

c) rw-rw-rw- rw---

7. Below is the code:

int main() {
int fd1, fd2;
struct stat buff1, buff2;
fd1 = open("1.txt", O_RDWR);
fd2 = open("2.txt", O_RDWR | O_APPEND);
lseek(fd1, 10000, SEEK_SET);
write(fd1, "abcdefghij", 10);
write(fd2, "abcdefghij", 10);
fstat(fd1, &buff1);
fstat(fd2, &buff2);
printf(" %d %d", buff1.st_size, buff2.st_size);
return 0;
}

Before running the program, the file 1.txt and 2.txt size is 20 each. What is the output?
a) 30 30
b) 100020 20
c) 100030 30
d) 100010 30

d) 100010 30

8. Which function can be used instead of the dup2 to duplicate the file descriptor?
a) read()
b) open()
c) stat()
d) fcntl()

d) fcntl()

9. If one of the thread in multi-threaded process is blocked on an I/O, which of the following is true?
a) The entire process with block if their is no kernel supported threads
b) Other threads of the process will continue to execute even if there is no kernel supported threads
c) It depends on specific implementatation
d) All of the above

a) The entire process with block if their is no kernel supported threads

10. If the fork() system call returns -1, then it means?
a) No new child process is created
b) The child process is an orphan
c) The child process is in Zombie

a) No new child process is created

Download Interview PDF



SHARE



FeedBurner

FORUM
PRIVACY
TERMS & CONDITIONS
FEED BACK

Submit Your Feedback:


×

Thank You For Your Feedback!

Your message has been sent successfully.

Disclaimer
Interview Questions Answers .ORG is responsive and optimized web portal for individuals to get preparation for their job interviews, learning and training. Content at Interview Questions Answers .ORG might be simplified to improve our users experience. We constantly review our content to avoid errors and copyright violations, but we cannot warrant full correctness of all the content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2007-2021 by Interview Questions Answers .ORG All Rights Reserved.

Interview Questions Answers .ORG
Face Book Twitter Linkedin