0% found this document useful (0 votes)
99 views11 pages

1) What Do You Mean by Hardware and Software?: C Viva Questions

The document contains 36 questions about C programming concepts. It covers topics like hardware and software, computer components and their functions, operating systems, algorithms, flowcharts, data types in C, format specifiers, scanf() and printf() functions, variable types and ranges, preprocessor directives, variable scope, signed values, reserved words, type declaration, identifiers, operators, loop statements, networks, arrays, multidimensional arrays, strings, string handling functions, constants, debugging, logical NOT operator, operator precedence, string functions like strcat() and strcmp(), functions, built-in vs user-defined functions, actual and formal arguments, void type, and recursion.

Uploaded by

Jyothi snmp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views11 pages

1) What Do You Mean by Hardware and Software?: C Viva Questions

The document contains 36 questions about C programming concepts. It covers topics like hardware and software, computer components and their functions, operating systems, algorithms, flowcharts, data types in C, format specifiers, scanf() and printf() functions, variable types and ranges, preprocessor directives, variable scope, signed values, reserved words, type declaration, identifiers, operators, loop statements, networks, arrays, multidimensional arrays, strings, string handling functions, constants, debugging, logical NOT operator, operator precedence, string functions like strcat() and strcmp(), functions, built-in vs user-defined functions, actual and formal arguments, void type, and recursion.

Uploaded by

Jyothi snmp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

C viva questions

1) What do you mean by Hardware and Software?


All the electronic/electrical components and circuits used in a computer
system are called hardware. A computer is actuated and controlled with the
help of computer programs called software.
2) Mention the main components of a computer and their funtions.
CPU (cenral processing unit) – to process the data
Input Device – to enter the dat into the computer.
Output Device – to display / print results by the computer.
3) What is Operating System(OS) ?
An operating system is a collection of programs used to connect the user with
the hardware It has the set of programs which controls the operations of the
hardware components such as CPU, main memory, keyboard, monitor, printer
and so on.
4) What is Algorithms?
An algorithms refer to the step by step instructions written to solve any
problem.
 
5) What is Flowchart ?
A flowchart is a diagrammatic or symbolic representation of an algorithms. It
uses various symbols to represent the operations to be performed.
 
6) Name the four basic data types in “C” language?
The four basic data types in “c” language are as follows
char – a character
int – an integer, in the range -32,767 to 32,767
long int – a larger integer (up to +-2,147,483,647)
float – a floating-point number
double – a floating-point number, with more precision and perhaps greater
range than float
 
7) Describe at least five different format specifiers?
%d: -An integer whole number
%f: -a floating point number
%c: -a single character
%s: -a string of value of characters.
 
8) Define and explain scanf () function?
The Scanf () function can be used to get input into a program and it requires
two arguments. First a format specifier defines the type of data to be entered,
then the name of the variable in which the input will be stored. This scanf ()
function is responsible for giving input into the program.
 
9) Define and explain printf () function?
The printf() function is used to display/output values of variable in the monitor.
The printf function has general form: printf (“format specifiers”,variables)
 
10) What are the maximum and minimum possible ranges of values for
long and short type?
If the int variable is created by default as a ‘long’ type it typically will have a
possible range of values from a maximum of +214748347 and a minimum of
-2147483648. For ‘short’ type these are the maximum and minimum values
+327676 and minimum -32768.
(While answering this question you can specify the approximate value raised
to power).
 
11) What is preprocessor?
The preprocessor is a program which is executed before the compilation of a
source program written by the user. The preprocessor directives begines with
hash (#) followed by the command. e.g #include – it is a directive to include
file.
 
12) What exactly is a ‘variable scope’, ‘local variables’ and ‘global
variables’?
The extent to which a variable is accessible in a program is called the
‘variable scope’. Variables declared internally inside a function are known as
‘local’ variables.
Variables declared externally outside a function are known as ‘global’
variables.
 
13) What are signed values?
When an int variable is declared it can by default contain either positive of
negative integer values. These are known as ‘signed’ values. The range of
positive values is determined by your system.
 
14) Define reserved words.
C programs are constructed from a set of reserved words which provide
control and from libraries which perform special functions. The basic
instructions are built up using a reserved set of words, such as main, for,
if,while, default, double, extern, for, and int, to name just a few.
 
15) What is the purpose of type declaration in C ?
All variables used in a C program are declared using the appropriate data
types to enable the compiler to allocate the required number by bytes in RAM
to store values of these variables in memory
 
16) What is identifier ?
An identifier is a name used to identify a variable, function, symbolic constsnt
and so on.
 
17) Mention the different types of operators used in C ?

1. Arithmetic operator
2. Relational operators
3. Logical Operators
4. Increment and decrements operators
5. 5.Assignment operators
6. 6.Conditional operator
7. Bitwise oprators

 
18) What is Loop control statements ?
Loop control structures are used to execute and repeat a block of statements
depending on the value of a condition. There are 3 types of loop control
statements in C

1. for loop
2. while loop
3. do – while loop

 
19) explain while loop .
A while loop has one control expression, and executes as long as that
expression is true. The general syntax of a while loop is
while( expression ){

statements

we use a while loop when a statement or group of statements which may have
to be executed a number of times to complete their task. The controlling
expression represents the condition
 
20) explain for loop .
A for loop is used to execute and repeat a block of statements depending on a
condition. The syntax of a for loop is
for( ; ; )

statements

 
21) What do mean by network ?
Computer networking refers to connecting computers to share data,
application software and hardware divices. Networks allow sharing of
information among various computers and permit users to share files
 
22) List a few unconditional control statement in C.

1.  break statement
2.  continue statement
3.  goto statement
4. exit() function

 23) What is an array ?


An array is a collection of values of the same data type. Values in array are
accessed using array name with subscripts in brackets[]. Synatax of array
declaration is
data type array_ name[size];
 
24) What is Multidimensional Arrays
An array with more than one index value is called a multidimensional array. To
declare a multidimensional array you can do follow syntax
data type array_ name[] [] []….;
 
25) Define string ?
An array of characters is known as a string.for example
char st[8]; this statement declares a string array with 80 characters .
 
26) Mention four important string handling functions in C languages .
There are four important string handling functions in C languages .

1. strlen();
2.  trcpy();
3. strcat();
4. strcmp();

The header file #include is used when these functions are called in a C
program.
 27) Explain about the constants which help in debugging?
A #if directive test can be offered with #else and #else if directives. This
allows conditional branching of the program to run sections of the code
according to the result. Constants defined with a #define directive can be
undefined with the #undef directive. The #ifdef directive has a companion
directive #ifndef. These commands can be useful when debugging problem
code to hide and unhide sections of the program.
 28) Define and explain about ! Operator?
The logical operator ! NOT is a unary operator that is used before a single
operand. It returns the inverse value of the given operand so if the variable “c”
had a value of true then! C would return value of false. The not operator is
very much useful in C programs because it can change the value of variables
with successful iterations. This ensures that on each pass the value is
changed.
 
29) What is operator precedence?
Operator precedence defines the order in which C evaluates expressions.
e.g. in the expression a=6+b*3, the order of precedence determines whether
the addition or the multiplication is completed first. Operators on the same row
have equal precedence.
 30) Explain about the functions strcat() and strcmp()?
This function concatenates the source string at the end of the target string.
Strcmp() function compares two strings to find out whether they are the same
or different. The two strings are compared character by character until there is
a mismatch or end of one of the strings is reached, whichever occurs first. If in
case two strings are identical, a value of zero is returned. If there is no
matches between two strings then a difference of the two non matching
values are returned according to ASCII values.
 
31) Define function
A function is a module or block of program code which deals with a particular
task. Each function has a name or identifier by which is used to refer to it in a
program. A function can accept a number of parameters or values which pass
information from outside, and consists of a number of statements and
declarations, enclosed by curly braces { }, which make up the doing part of the
object
 
32) Differentiate built-in functions and user – defined functions.
Built – in functions are used to perform standard operations such as finding
the square root of a number, absolute value and so on. These are available
along with the C compiler and are included in a program using the header files
math.h, s tring.h and so on.
User defined functions are written by the user or programmer to compute a
value or perform a task. It contains a statement block which is executed
during the runtime whenever it is called by the main program.
 33) Distinguish between actual and formal arguments.
Actual arguments are variables whose values are supplied to the function in
any function call. Formal arguments are variables used to receive the values
of actual arguments from the calling program.
 
34) Explain the concept and use of type void.
A function which does not return a value directly to the calling program is
referred as a void function. The void functions are commonly used to perform
a task and they can return many values through global variable declaration.
 35) What is recursion ?
A function calling itself again and again to compute a value is referref to as
recursive function or recursion. Recursion is useful for branching processes
and is effective where terms are generated successively to compute a value.
 36) Mention the types of network.
A simple network consist of computers connected using nework interface
cards, networking software and network cables. There are two main
networking arrangents

1. i) client / server – a powerful computer is used as the server which


works as the interpreter between the clients and helps sharing files.

ii)peer to peer – there is no server and all the workstations are treated equally.
 
37) what are Library functions?
Library functions are built in programs available along with the compiler which
perform some standard mathematical operations.
 38) How does the type float differ from double in C language ?
Float data type refers real number in single precision and has 6 decimal digits.
It takes 4 bytes in memory to refer values ranging from 3.4e-38 to 3.4e+38
double data type also refers to real number but in double precision and has 12
decimal digits. It takes 8 bytes of memory to refer values ranging from 1.7e-
308 to 1.7e+308
 39) What is an operator and operand?
An operator performs an operation like addition, subtraction and so on and
produce a value. Variables and constants upon which operations are
performed are called operands.
 
40) What is RAM ?
RAM – Random Access Memory is a temporary storage medium in a
computer. RAM is a volatile memory i.e all data stored in RAM will be erased
when the computer is switched off.
 
41) What is ROM ?
ROM – Read Only Memory is permanent storage medium which stores start
up programs (operating system programs) and BIOS programs which are
recorded by the manfacturer of the compiler system. ROM is a non-volatile
memory.
 
42) Define system software.
System software is a collection of programs which are used to assist the user
to handle the computer hardware like printer, disk and so on and execute the
application programs.
 43) Define application software
application softwares are programs which are used to solve specific
problems /tasks. Examples include railway reservation, banking and so on.
 44) What are control ststements ?
All the statements written in a program are executed from top to bottom one
by one. Control statements are used to execute / transfer the control from one
part of the program to another depending on a conditions.
 45) What is Parallel Computation?
Computations that use multi-processor computers and/or several independent
computers interconnected in some way, working together on a common task.

 Examples: CRAY T3E, IBM-SP, SGI-3K, Cluster of Workstations.

 46) Why use Parallel Computation?

 Computing power (speed, memory)


 Cost/Performance
 Scalability
 Tackle intractable problems

47) Explain increment and decrements operators .


++ increment operator which add one to the value,

example : i++ (which adds one to i and results is scored back to)

— decrement operator which subtracts one from the value

example — i ( which subtracts one from i)

 
48) Mention the types of memory
Two major types of memory storage is primary memory and secondary
memory. Primary storage (or main memory or internal memory), often referred
to simply as memory, is the only one directly accessible to the CPU.
Secondary memory (or external memory) differs from primary storage in that it
is not directly accessible by the CPU. Some of the example for secondary
memory includes floopy disks, flash memory, mengetic tape, hard drives etc.
 
49) What are input and output device ?
Input and Output Devices: Input devices are the hardware that are used for
providing information to the computer like mouse and keyboard and output
devices are the hardware that are used for receiving information from
computer like monitor, printer or the sound system.

 Compile Colloquially, to convert a source code file into an executable, but strictly speaking,
compilation is an intermediate step
 Link The act of taking compiled code and turning it into an executable
 Build A build refers to the process of creating the end executable (what is often colloquially
referred to as compilation). Tools exist to help reduce the complexity of the build process—make
files, for instance.
 Compiler Generally, compiler refers to both a compiler and a "linker"
 Linker The program that generates the executable by linking
 IDE Integrated Development Environment(ex: turbo C), a combination of a text editor and a
compiler, such that you can compile and run your programs directly within the IDE. IDEs
usually have facilities to help you quickly jump to compiler errors.

What compilers are available?


Windows
 Code::Blocks and MINGW Our recommended free compiler setup! Code::Blocks is also
available on Linux.
 Borland Find out how to download and set up Borland's free command-line compiler
 Microsoft Visual C++ Read about Visual C++

*nix
 g++ is a C++ compiler that comes with most *nix distributions.
 gcc is a C compiler that comes with most *nix distributions.

Mac OS X
 Apple XCode XCode is the development platform to use for OS X or iPhone programming.

You might also like