January 21, 2019

Srikaanth

ATOS Frequently Asked Linux Interview Questions Answers

How To Get Input From The Terminal For Shell Script?

‘read’ command reads in data from the terminal (using keyboard). The read command takes in whatever the user types and places the text into the variable you name.

Example is shown below

# vi /tmp/test.sh

#!/bin/bash

echo ‘Please enter your name’

read name

echo “My Name is $name”

# ./test.sh

Please enter your name

LinuxTechi

My Name is LinuxTechi
ATOS Frequently Asked Linux Interview Questions Answers
ATOS Frequently Asked Linux Interview Questions Answers

What Is The Use Of Continue Command In Shell Scripting?

The continue command is identical to break command except it causes the present iteration of the loop to exit, instead of the entire loop. Continue command is useful in some scenarios where error has occurred but we still want to execute the next commands of the loop.

What Is Shell Script And Why It Is Required?

A Shell Script is a text file that contains one or more commands. As a system administrator we often need to issue number of commands to accomplish the task, we can add these all commands together in a text file (Shell Script) to complete daily routine task.

What Is The Default Login Shell And How To Change Default Login Shell For A Specific User?

In Linux like Operating system “/bin/bash” is the default login shell which is assigned while user creation. We can change default shell using the “chsh” command.

Example is shown below

# chsh <username> -s <new_default_shell>

# chsh linuxtechi -s /bin/sh

Basic Syntax Of Do-while Statement?

The do-while statement is similar to the while statement but performs the statements before checking the condition statement.

The following is the format for the do-while statement

do

{

statements

} while (condition)

How To Define Functions In Shell Scripting?

A function is simply a block of of code with a name. When we give a name to a block of code, we can then call that name in our script, and that block will be executed.

Example is shown below:$ disk usage () { df -h ; }

How To Use Bc (bash Calculator) In A Shell Script?

Use the below Syntax to use bc in shell script.

Variable=`echo “options; expression” | bc`.

What Is The Basic Syntax Of While Loop In Shell Scripting?

Like the for loop, the while loop repeats its block of commands a number of times. Unlike the for loop, however, the while loop iterates until its while condition is no longer true.

The basic syntax is

while [ test_condition ]

do

commands…

done

How To Make A Shell Script Executable?

Using the chmod command we can make a shell script executable.

Example is shown below

# chmod a+x myscript.sh

What Is The Use Of “#!/bin/bash” ?

#!/bin/bash is the first of a shell script , known as shebang , where # symbol is called hash and ‘!’ is called as bang. It shows that command to be executed via /bin/bash.

What Is The Syntax Of For Loop In Shell Script?

Basic Syntax of for loop is given below

for variables in list_of_items

do

command1

command2

….

last_command

done

How To Debug A Shell Script?

A shell script can be debug if we execute the script with ‘-x’ option ( sh -x myscript.sh). Another way to debug a shell script is by using ‘-nv’ option (sh -nv myscript.sh).

How Compare The Strings In Shell Script?

Test command is used to compare the text strings. The test command compares text strings by comparing each character in each string.

What Are The Special Variables Set By Bourne Shell For Command Line Arguments?

The following table lists the special variables set by the Bourne shell for command line arguments.

Special Variables: Holds

$0: Name of the Script from the command line
$1: First Command-line argument
$2: Second Command-line argument
…..
…….
$9: Ninth Command line argument
$#: Number of Command line arguments
$*: All Command-line arguments, separated with spaces

How To Test Files In A Shell Script?

Test command is used to perform different test on the files. Basic test are listed below

Test: Usage

-d file_name: Returns true if the file exists and is a directory.
-e file_name: Returns true if the file exists.
-f file_name: Returns true if the file exists and is a regular file.
-r file_name: Returns true if the file exists and have read permissions.
-s file_name: Returns true if the file exists and is not empty.
-w file_name: Returns true if the file exists and have write permissions.
-x file_name: Returns true if the file exists and have execute permissions.

How To Unset Or De-assign Variables?

‘unset’ command is used to de-assign or unset a variable.

Syntax is shown below

# unset <Name_of_Variable>

How To Perform Arithmetic Operation?

There are two ways to perform arithmetic operations

Using expr command (# expr 5 + 2).
Using a dollar sign and square brackets ( $[ operation ] ) Example : test=$[16 + 4] ; test=$[16 + 4].

Explain What Is Microcontroller?

The microcontroller is a self-contained system with peripherals, memory and a processor that can be used as embedded system.

Mention What Is The Difference Between Microprocessor And Microcontroller?

Microprocessor is managers of the resources (I/O, memory) which lie outside of its architecture Microcontroller have I/O, memory, etc. built into it and specifically designed for control.

What Does Dma Address Will Deal With?

DMA address deals with physical addresses. It is a device which directly drives the data and address bus during data transfer. So, it is purely physical address.

Explain Interrupt Latency And How Can We Decrease It?

1.Interrupt latency basically refers to the time span an interrupt is generated and it being serviced by an appropriate routine defined, usually the interrupt handler.
2.External signals, some condition in the program or by the occurrence of some event, these could be the reasons for generation of an interrupt.
3.Interrupts can also be masked so as to ignore them even if an event occurs for which a routine has to be executed.
4.Following steps could be followed to reduce the latency

•ISRs being simple and short.
•Interrupts being serviced immediately
•Avoiding those instructions that increase the latency period.
•Also by prioritizing interrupts over threads.
•Avoiding use of inappropriate APIs.

How To Create A Child Process In Linux?

Prototype of the function used to create a child process is pid_t fork(void);
•Fork is the system call that is used to create a child process. It takes no arguments and returns a value of type pid_t.
•If the function succeeds it returns the pid of the child process created to its parent and child receives a zero value indicating its successful creation.
•On failure, a -1 will be returned in the parent's context, no child process will be created, and errno will be set.
•The child process normally performs all its operations in its parents context but each process independently of one nother and also inherits some of the important attributes from it such as UID, current directory, root directory and so on.

Significance of watchdog timer in Embedded Systems.
•Watchdog timer is basically a timing device that is set for predefined time interval and some event should occur during that time interval else the device generates a time out signal.
•One application where it is most widely used is when the mobile phone hangs and no activity takes place, in those cases watchdog timer performs a restart of the system and comes to the rescue of the users.
•It is used to reset to the original state whenever some inappropriate events take place such as too many commands being given at the same time or other activities that result in malfunctioning of the GUI. It is usually operated by counter devices.

What Is The Difference Between Hardware Design And Software Design?

•Hardware design is designed with the collaboration of interconnected parallel components that inherits the properties of each other. Whereas, Software design is designed with sequential components, that are based on objects and threads.

•Hardware design structure doesn’t change dynamically and it can’t be created, modified or removed easily. Whereas, Software design structure can be changed dynamically and re-usability features, used to define the components. It also includes easy creation, modification and removal of the components from the software.

•Hardware design focuses on individual components that are represented using analytical model that uses the transfer functions. Whereas, Software design represent the components using computation model that can have abstract execution engine or it can use the virtual machine that are non-deterministic.

Explain What Is Interrupt Latency? How Can You Reduce It?

Interrupt latency is a time taken to return from the interrupt service routine post handling a specific interrupt.  By writing minor ISR routines, interrupt latency can be reduced.

Mention What Are Buses Used For Communication In Embedded System?

For embedded system, the buses used for communication includes

• I2C: It is used for communication between multiple ICs
• CAN: It is used in automobiles with centrally controlled network
• USB: It is used for communication between CPU and devices like mouse, etc.

While ISA, EISA, PCI are standard buses for parallel communication used in PCs, computer network devices, etc.

List Out Various Uses Of Timers In Embedded System?

Timers in embedded system are used in multiple ways

• Real Time Clock (RTC) for the system
• Initiating an event after a preset time delay
• Initiating an even after a comparison of preset times
• Capturing the count value in timer on an event
• Between two events finding the time interval
• Time slicing for various tasks
• Time division multiplexing
• Scheduling of various tasks in RTOS

Explain What Is A Watchdog Timer?

A watchdog timer is an electronic device or electronic card that execute specific operation after certain time period if something goes wrong with an electronic system.

Explain What Is Embedded System In A Computer System?

An embedded system is a computer system that is part of a larger system or machine.  It is a system with a dedicated function within a larger electrical or mechanical system.

Mention What Are The Essential Components Of Embedded System?

Essential components of embedded system includes

•Hardware
•Processor
•Memory
•Timers
•I/O circuits
•System application specific circuits
•Software
•It ensures the availability of System Memory
•It checks the Processor Speed availability
•The need to limit power lost when running the system continuously
•Real Time Operating System
•It runs a process as per scheduling and do the switching from one process to another

Subscribe to get more Posts :