Linux Programming Question Bank

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8
At a glance
Powered by AI
Some of the key takeaways from the document include processes, signals, inter-process communication mechanisms like pipes, message queues and shared memory in Linux/Unix.

The child process inherits properties like the user ID, group ID, supplementary group IDs, session ID, process group ID, parent process ID, file mode creation mask (umask), current working directory, root directory, file descriptor table, signal dispositions from the parent process.

When a semaphore is created, the kernel stores the initial semaphore value and optionally a queue of pending operations associated with the semaphore.

JNTU World

or
ld

www.alljntuworld.in

PART A (Short Answer Questions)

Questions

TU

Q. No

Blooms
Course
Taxonomy
Outcome
Level

UNIT I

What is an operating system?

Remember

Explain the significance of the following commands.


i. ls - ld ii. ls - l.

Understand

3
4
5
6
7
8
9
10
11

Define Shell and kernel.


Define comm command. What are the options in comm.
What is a filter in UNIX?
Discuss the various backup utilities available in UNIX.
Which is the command used for ordering a file?
What is the usage of filters?
What is the purpose of cat?
What is the difference between shell and kernel.
Explain the following Unix shell commands with examples.
i.cut ii. Paste iii. Egrep iv. fgrep.

Knowledge
Knowledge
Remember
Understand
Remember
Remember
Remember
Remember
Understand

1
3
3
3
3
3
3
3
3

12
13
14
15
16
17
18

Write a shell script to dis lay first n numbers of Fibonacci series.


Write short notes on shell script arguments.
Explain briefly about shells available in Unix.
Define Unix shell. Explain shell environment.
How to remove duplicate lines from a file using sort?
Explain awk, tar, cpio with necessary examples.
What is the difference between the text editing provided by ed & vi text editors.
UNIT-II
Write the syntax for
i. mkdir
ii. rmdir
iii. chdir
What is the file server in Linux server?

Apply
Apply
Understand
Knowledge
Remember
Understand
Remember

5
4
5
5
5
5
5

JN

1
2

Downloaded From JNTU World (http://www.alljntuworld.in)

Apply

Remember

www.alljntuworld.in

JNTU World

Write the difference between fgetc and getc system calls.


Write the syntax of fflush system call give an example.
Write about ulink system call and give an example.
Write the syntax for
i.
Opendir
ii. Readdir
iii. Closedir
iv.rewind dir

Apply
Apply
Apply
Apply

6
6
6
8

7
8
9
10
11
12

Explain the differences between fgets, gets system call.


Explain link, unlink, remove and rename functions with syntaxes.
What are fflush and fseek functions? Explain.
Explain in detail about lseek function.
What is fcntl function? What is the purpose of using it?
Write the syntax of creat function.

Understand
Understand
Remember
Understand
Remember
Apply

7
7
7
7
7
7

13

What is the difference between home directory and working directory?

Remember

14

What is the difference between internal and external commands?

Remember

15

What are stat, fstat and lstat functions

Remember

1
2

What is a process.

Remember

13
13

or
ld

3
4
5
6

UNIT III

4
5
6
7
8

What are the uses of fork function?


Write the syntax of following functions. Explain each argument.
* kill
* raise
* alarm
* exit

Remember

13

Apply
Apply

Write the differences between wait and waitpid system calls.


What is a zombie process?

Remember

Explain threads.

Understand

Write the system calls for process termination in detail.


Write a program to illustrate the vfork function call.

Apply
Apply

13
13
13
13
13

Remember

13

Apply

13

Apply

13

Apply

13

Remember

13

TU

What is a signal.

10

Write a program which uses both kill and raise functions.

11

Write a program which uses abort function.

12
13

Write the differences between threads and processes.


What is orphan process.

UNIT IV

Define Inter Process Communication?

Knowledge

2
3

State the importance of file locking .


What is a pipe?

Knowledge
Remember

11
12

4
5
6
7
8

What is a FIFO? Why FIFOs are called as named pipes?


List out the rules for writing information into the pipe.
Write the differences between named and unnamed pipes.
What is a Semaphore.
Write about
i.
popen
ii.pclose
library functions
Write a program to create a pipe and to execute it on the client.
Write about different Unix locking techniques.
Write the differences between fcntl function and flock function.
What is a Message queue.
Write about File Locking with Semaphores
UNIT V
What is a socket.
Write about shared memory advantages and disadvantages.
Write the differences between unix domain and internet domain.

Remember
Knowledge
Apply
Remember
Apply

12
12
12
11
11

Apply
Apply
Apply
Remember
Apply

12
5
9
9
9

Remember
Apply
Apply

14
10
14

JN

9
10
11
12
13
1
2
3

Downloaded From JNTU World (http://www.alljntuworld.in)

11

www.alljntuworld.in

JNTU World

Explain socket system call.

5
6
7
8
9

Write about Socket system calls for connection oriented protocol.


Write about Socket system calls for connectionless oriented protocol.
Write about fcntl system calls.
Write about domain socket advantages.
Write about
i.
getsockopt
ii.setsockopt functions

10

Give an example for Shared Memory.

Understand

14

Apply
Apply
Apply
Apply
Apply

14
14
14
14
14

Understand

10

JN

TU

or
ld

Downloaded From JNTU World (http://www.alljntuworld.in)

www.alljntuworld.in

JNTU World

PART B (Long Answer Questions)

Q. No

Questions

Blooms
Taxonomy
Level

Course
Outcome

Understand
Remember
Remember

1
2
2
2
3
4
3
2

Knowledge
Understand
Understand

6
4

12

Explain with example the Process of Creation and Execution of a Shell Script.

Understand

13

write shell scripts on prime number and Fibonacci series by using control
structures?
UNIT II
Explain the following System Calls with an Example.
a) creat( )
b)write( )
c) stat( )
d) fcntl( )

4
5
6
7
8

or
ld

Understand
Knowledge
Understand
Understand
Understand

9
10
11

UNIT I
Explain how Unix operating system provides more security than any other
operating
system.
what at are
file handling utilities and processing utilities?
What are the file permissions for providing security to the files?
Explain how Unix operating system provides more security than any other
operating system.
Describe the file access permissions in Unix.
[12]
ExplainShell
howand
Unix
system provides more security than any other
Define
itsoperating
Responsibilities.
operating
system.
Explain how
Unix
operating
providesof
more
than any other
Describe
thesystem
characteristics
Unixsecurity
File System.
Explain
how
Unix
operating
system
security than any other
operating
system.
Explain text
processing
utilities
and provides
Networkmore
commands?
operating
system.
Explain the
control structures of shell programming with suitable examples?
Explain how Unix operating system provides more security than any other
operating system.
Write about here documents ?
Describe pipe, input redirection and output redirection?
Explain various meta characters in shell with an example script.

1
2
3

Apply

3
2

Understand

Write about File and Directory maintenance system calls? (Give syntax &
examples).
Discuss clearly
the Low Level File I/O System Calls.
Explain dup() and its importance.

Apply
Understand
Understand

8
6
6

5
6
7

Define file descriptor and explain different system calls used in file?
explain the file structure related system calls?
Explain the following System Calls with an Example.
a) read() b) close()
c) open()
Explain link, unlink, remove and rename functions with syntaxes.

Knowledge
Understand

6
6
6

TU

2
3
4

10

Understand

Understand

Understand

Understand

Give the syntaxes for chmod and fchmod functions and state their importance.
1.
Write the syntax of following system calls. *unlink

JN

Understand

Explain about file descriptors & i-node?

11

Explain the following commands with examples:


(a) Creating a Directory
(b) Copying a file from one directory to another
(c) Moving the files between Directories
(d) Deleting a Directory and a File.
UNIT III

1
2

Differentiate between a process, a program and a job.


Explain the following with example:
(a) Process Creation
(b) Process Termination
(c) Signal function
(d) Reliable signals.
What is an orphan process? Write a program to illustrate orphan process.
Downloaded From JNTU World (http://www.alljntuworld.in)

c
)
Understand

12

Remember

12

o
p
e
n
(
)

www.alljntuworld.in

JNTU World

What is a zombie process? Write a sample program to explain about zombie


process.

5
6
7
8
9
10

Differentiate between fork( ) and vfork( ).


What is a Zombie Process? What is its significance? Describe with an example.
Define Signals. What do you mean by Unreliable Signals? Explain
Explain clearly the Signal concept with a suitable example
Explain the Data Structures that are affected when a process gets created
or deleted. between the following terms:
Differentiate
(a) getc( ) Vs fgetc( )
(b) stat( ) Vs fsat( )
(c) printf( ) Vs fprint( )
(d) scanf( ) Vs fscanf( ).

11

What is need of exec( ) system call? Write syntax.

12
13

12

Remember
Knowledge
Understand
Understand
Understand

12
12
12
12
12
3

Remember

Write a C program to illustrate exec( ) function.

Apply

Write the syntax of following functions. Explain each argument.

Apply

*
*
*
*

kill
raise
alarm
exit

Compare the IPC functionality provided by message queues and fifos. What
are the advantages and drawbacks of each? Explain briefly.

1
Co

Remember

or
ld

Understand

11

Apply

11

Write a program to simulate sleep and wakeup behaviors among two processes
using any IPC mechanisms.

3
4
5

What are the security problems associated with system V IPC mechanisms?
Write a program to illustrate client/server application using named pipes.
Write a program and explain how to transfer a large amount of data between two
processes using:
(a) Pipes
(b) Message queues.

Remember
Apply
Apply

11
12
12

Explain the concept of IPC between two processes on a single system. Give
Example.
Define
Inter Process Communication? Explain IPC between two processes on
different
What
is asystems.
pipe? Using pipe, how IPC can be implemented.
Describe the functionality provided by system V IPC semaphore mechanism. Explain
it is implemented.
Writehow
a program
to illustrate client/server application using named pipes.
UNIT V
What is socket? Explain various socket system calls used for UDP protocol.

Understand
Knowledge
Remember
Apply

11
11
12
11
12

Remember

14

Apply

14

Remember
Understand
Understand

14
14
14

Understand
Remember

10
10
10
10
10
10

TU

JN

6
7
8
9
10
1
2

Write a brief description on sockets and socket system calls (connection


oriented and connectionless protocols)?

3
4
5

What are Berkely sockets ? And write a note on socket options?


Explain socket system calls for connectionless protocol.
Discuss the following:
a) Socket System Calls for Connection Oriented Protocol.
Explain with example the Kernel Support and working of Shared Memory
What is fcntl system call? What is the purpose of using it?
Explain about Unix domain and Internet Domain.
Explain how to control a shared-memory segment.
Explain how to attach and detach a shared-memory segment.
Explain how the fcntl ( ) system call is used for changing the properties of a
file.What are the status ags that are associated with fcntl( )? Illustrate fcntl( ) with a
program.

6
7
8
9
10
11

Downloaded From JNTU World (http://www.alljntuworld.in)

Understand
Understand
Understand

www.alljntuworld.in

JNTU World

PART C (Problem Solving and Critical Thinking Questions)

UNIT-I

2
3
4
5
6

7
8
9
10

Write a shell script to print the details of the user login information.
How do you clean the screen and place the cursor at row 15 and
column 20?

Apply
Remember

12

1
4
5
10

Remember

Write a shell script Which gets executed the moment the user logs in. It should displayApply
the
message "good morning/good aft rnoon/good evening" depending upon the time at
Which the user logs in.
Determine whether the Linux system to have multiple desktop environments
Understand
installed?
Understand
Determine whether the Ctrl+Alt+Del key combination work on Linux?
Remember
How do you change permissions under Linux?

What is the the difference between Umask and Ulimit?

Remember

Which is the command used for ordering a file? Discuss all the options available for
this command. For every option Explain with an example.

Understand

What is the difference between UNIX and LINUX?

6
6
6

11

"Operating systems like UNIX provide services both for programs and users". Justify Knowledge
this statement with suitable example.
Explain how debugging can be done in a shell script.
Understand

or
ld

Write a shell script Which receives two filenames as arguments. It should check whether theApply
two files contents are same or not. If they are same then second file should be deleted. Use
cmp command to compare files.

UNIT-II

Write about ulink system call and give an example.


Write about Write system call and illustrate with an example.
What is the purpose of dot and dot dot directories in the file system?
What are the drawbacks of using a symbolic link instead of a hard link.

Apply
Apply
Knowledge
Knowledge

5
5
8
5

5
6

List out the few differences between softlink and hard link.
What is the difference between home directory and working directory?

Knowledge
Knowledge

5
8

What is the difference between internal and external commands?

Knowledge

8
9

How does the linux file system work?

Remember
Apply

6
5

Apply

Remember

2
3

what are the different properties that are inherited by the child from its parent. Explain. Knowledge
Remember
How do you terminate an ongoing process?

13
13

Apply

13

Write a program to simulate sleep and wakeup behaviors among two processes using
any IPC mechanisms.
What is an orphan process? Write a program to illustrate orphan process.

Remember

13

Explain various exit statuses with an example program.

Understand

13

TU

1
2
3
4

JN

Write a C program to print the type of specified file (Regular, device, directory)

10

Write a shell script to check whether a Given file is a directory. If so, empty the
contents of the directory and remove the directory.
UNIT-III

How do you open a command prompt when issuing a command?

Downloaded From JNTU World (http://www.alljntuworld.in)

www.alljntuworld.in

JNTU World

What are the signals that are not ignored or blocked? Explain the reason behind it with Remember
an example.

13

What is a zombie process? Write a sample program to explain about zombie process.. Remember

13

What are reliable signals? Explain about the primary features of reliable functions.
Illustrate an example program for handling reliable signals.

Remember

13

10

Explain the differences between thread and process

Understand

13

or
ld

UNIT-IV

What is the data stored by the kernel when a semaphore is created.

Remember

14

The syntax of msgget system call is int msgget(key t key, int flag)
* Explain type of key
* Explain What value it returns
* What is the use of flag

Understand

11

Compare the IPC functionality provided by pipes and message queues. What are
the advantages and drawbacks of each? When is one more suitable than the other.

Understand

11

Write a program to create a pipe and to execute it on the client.

Apply

11

Compare the IPC functionality provided by pipes and message queues. What are the
advantages and drawbacks of each? Explain briey.

Understand

11

What are the security problems associated with system V IPC mechanisms?

Remember

11

Write a program to illustrate client/server application using named pipes.

Apply

12

TU

Write a C program to create a message queue with read and write permissions and
write 3 messages to it with different priority numbers.

Apply

12

Write a C program that receives the messages from the above message queue and
display them.

Apply

12

10

What are the disadvantages of pipes? Write a program to implement client-server


system using named pipes.

Remember

12

State whether the FIFO, pipe & Unix domain socket the same thing in Linux kernel?

Knowledge

12

Distinguish UNIX Domain sockets &Shared Memory (Mapped File)

Understand

10

Apply

12

JN

1
2

UNIT-V

Write a C Socket Program for Linux with a Server and Client Example Code.

Write a C program to create a shared memory and store username and mobile number
details

Apply

12

Write a C program to use the shared memory created by the above program and print
the mobile number of a given username by searching the shared memory

Apply

12

Downloaded From JNTU World (http://www.alljntuworld.in)

www.alljntuworld.in

JNTU World

Explain a stream socket with a illustrative example for client/server program.

Understand

12

Explain a datagram socket with an illustrative example for client/server program.

Understand

12

Write and explain a program to transfer large amount of data between two
unrelated processes using shared memory.

Apply

12

Explain how to control a shared-memory segment.

Understand

12

10

Explain how to attach and detach a shared-memory segment.

Understand

12

JN

TU

or
ld

Downloaded From JNTU World (http://www.alljntuworld.in)

You might also like