Sunday, 9 February 2014

C interview asked question




              C INTERVIEW ASKED QUESTION -ANSWER



1.Why C Language?
C is one of the high level languages. It is a general purpose language, which means it can be used to write programs of any sort.

2.What are the advantages of c language?
• Easy to write
• Rich set of operators and functions that are built–in
• Support for bit–wise operation
• Flexible use of pointers
• Direct control over the hardware
• Ability to access BIOS/DOS routines
• Interacting using Interrupts
• Ability to write TSR programs
• Ability to create .COM files
• Ability to create library files (.LIB)
• Ability to write interface programs

3.What are the disadvantages of c language?
• C is considered difficult to learn
• Because of its conciseness, the code can be difficult to follow
• It is not suited to applications that require a lot of report formatting and data file
manipulation

4.What are the salient features of c languages?
• The following are the salient features of C language are :
• C is called a middle level language
• C supports structured design approach
• C is extensible
• C is rich in data types and operators
• C is portable

5.What is C token?
The smallest individual units of a C program are known as tokens.

6.List the different types of C tokens?
• Constants
• Identifiers
• Keywords
• Operators
• Special symbols
• Strings

7.What is string?
A string is a sequence of characters ending with NULL. It can be treated as a one–dimensional
array of characters terminated by a NULL character.

8.What is NULL character?
The NULL character is an escape sequence with ASCII value 0 and is different from the ASCII character'0'.

9.What is Pointer?
Pointer is a variable which store the address of other variable.Since pointer is a variable it has also its address.

10.What is Array?
Array is collection of multiple member of same type,stored in consecutive locations.Array can have more than one dimension.One dimension array is known as vector and two dimensional array is known as matrix.

11.What is Function?
Function is collection of statement which are use in order to perform specific task or operation.

12.Why we use Variable?
Variable is a identifier which are use for store and modify the data.

13.What is a Constant?
A constant is a value that does not change during the program execution. A constant used in
C does not occupy memory.

14.What are global variables?
Global Variables are those, which are required to be acccessed by all the functions defined after their declaration. So, the variables declared before the main {) can be acccessed by all the functions, which follow their declaration.
or ,you can say it in simple word a variatble which are declare outside the function is known as global variable .Global variable is store in data section of memory

15.What is a keyword?
Keywords are those words of C which have predefined meaning assigned by the C language.They form a part of the database required by the C compiler.or you can also state as keyword are the word whose meaning has already explained to the C compiler.

16.Give the rules for variable declaration?
• The rules for variable declaration in C are given below :
• A variable name consists of alphabets, digits and the underscore (_) character
• The length of variable should be kept upto 8 characters though your system may allow
upto 40 characters
• They must begin with an alphabet
• Some systems also recognize an underscore as the first character
• White space and commas are not allowed
• Any reserved word (keyword) cannot be used as a variable name.

17.What is data types?
Data types refer to the classes of data that can be manipulated by C programs. The three fundamental data types supported by C are character, integer and real type.

18.What is Recursion?
Recursion may be defined as when a function calling itself is known as recursion funtion.

19.Give the type of storage classes in C.
a)Automatic storage class.
b)Register storage class.
c)Static storage class.
d)External storage class.

20.What is difference between while and do-while?
In case of while first check condition given if true then loop execute if false then loop will not execute.But in case of do-while atleast one time loop will execute then after it check the condition.

21.Rule for constructing Real constant.
a)A real constant must have at least one digit.
b)It must have a decimal point.
c)It could be either positive or negative.
d)Default sign is positive.
e)No comma or blanks are allowed within a real constant.

22.What is data types?
Data types refer to the classes of data that can be manipulated by C programs. The three fundamental data types supported by C are character, integer and real type.

23.What are the different types of errors?
• Compile–Time Errors
• Linker Errors
• Runtime Errors
• Logical Errors

24.What are the type of data type in C?

  • float
  • integer
  • double
  • character
  • void
25.What is break statement?
When a break is encountered inside a loop, the loop is terminated and the control passes to
the statement following the body of the loop.

26.What is goto statement?
This is an unconditional control statement that transfers the flow of contorl to another part of the program.

27.what is continue statement?
The  continue statement is used when we want to go to the next iteration of the loop after skipping some statement of the loop.

28.What is the difference between break and continue statement?
The difference between break and continue is that when break is encountered the loop terminates and the control is transferred to the next statement following the loop,but when a continue statement is encountered the loop is not terminated and the next iteration of the loop starts.

29.What is nesting of loops?
When a loop is written inside the body of another loop,it is known as nesting of loops.

30.What is loop?
Loops are used when we want to execute a part of the program or a block of statements several times.

31 .What is macro?
The second preprocessor function is macro definition. A macro is formal syntax that can be used to generate statements for use in a program. For the C language, the macro generates C statements.

32.What is the difference between c &c++?
c++ is an object oriented programing but c is a procedure oriented programing.c is super set of c++. c can't suport inheritance,function overloading, method overloading etc. but c++ can do this.In c-programe the main function could not return a value but in the c++ the main function should return a value

33.What is friend function?
The function declaration should be preceded by the keyword friend.The function definitions does not use either the keyword or the scope operator :: The functions that are declared with the keyword friend as friend function.Thus, a friend function is an ordinary function or a member of another class

34.What is the use of getchar() function?
It returns a character just entered from the standard input unit, that is, keyboard. The entered character can be either assigned to a character variable or echoed to the computer screen.

35.What is the difference between single charater constant and string constant?
• A single character constant consists of only one character and it is enclosed within a
pair of single quotes.
• A string constant consists of one or more characters and it is enclosed within a pair of
double quotes.

36.What is numeric constant?
Numeric constants consist of numeric digits ,they may not have decimal points(.).

37.What is real constant?
Real constants are numeric constants that contain decimal point.

38.What is Whitespace character?
Space character ,newline characterhorizontal tab,vertical tab,and form feed are known as Whitespace character.

39.What are the different categories of functions in C?
• In C, the functions can be divided into the following categories :
• Functions with no arguments and no return values
• Functions having arguments but no return values
• Functions having arguments and return values also

40.What is compiler?
The compiler converts high lev el code to machine's assembly language code.

41.What is memory layout of C program?

  • text or code segment
  • initialized data segment
  • uninitialized data segment
  • stack
  • heap(unreserved section of memory)
42.What is signed and unsigned?

A numeric value, may have a positive or a negative sign. In the memory, for a variable, one bit is used exclusively to maintain the sign of the data. If we don't have sign, the sign bit also may be used for data. If the value is negative, the sign bit is 1, and if it is positive, it will be 0.

43.What is Lvalue require?
When the leftside value is not assigned then the Lvalue error occured.

44.What is typecasting?
Temporary change the type of data is known as typecasting.

45.What is the use of typedef?
The typedef help in easier modification when the programs are ported to another machine.A descriptive new name given to the existing data type may be easier to understand the code.

46.What is type of typecasting?

  • Implicit typecasting
  • Explicit typecasting
47.What is meant by type specifiers?

Type specifiers decide the amount of memory space occupied by a variable. In the ease of integral types; it also explicitly states the range of values that the object can hold..

48.What are the types of type specifiers?
• The available data type specifiers are :
• Short
• Long
• Signed
• Unsigned

49.What is heap section of memory?
Unreserved area of the memory is known as heap section.

50.What is masking?
Masking is a process in which a given bit pattern is partly extracted into another bit pattern by means of a logical bitwise operation

51.What is getch() function?
It returns a character just entered from the standard input unit. The entered character is not echoed on the screen. It reads a single character the moment it is typed without waiting for the Enter key to be hit.

52.What is putchar() function?
It prints the character constant or the character variable to the standard output device. The function putchar( ) has the following form : putchar (var name)

53.What is the use of bitwise operator?
The bitwise operator performs the operation on bits (i.e. bit by bit). Using the bitwise operators we can set / reset / check any bit in the value of the variable.

54.What is unary operator?
The operators that act upon a single operand to produce a new value are known as unary operators.

55.What is macro?
A macro is a fragment of code which has been given a name.Whenever the name is used,it is replace by the content of the macro

56.List the different type of C tokens.

  • identifier
  • keywords
  • variable
  • constants
  • operators
57.What is need of formate identifier?

To inform printf and scanf .printf for output and scanf for input.

58.What is local block?
A local block is any portion of C program that is enclosed by the left brace({) and the right brace(}).

59.What are the types of unary operators?
• C support unary operators are :
• minus operator -
• increment operator + +
• decrement operator –
• size operator
• (type) operator

60.What is fuction of Linker?
All program written in C use library function which is precompiled and their object code is stored in library file with .lib extension .Linker combine object code of library function with the object code of our program.

61.What is address operator?
It is given as' &' which returns the address of a variable when placed before it.This operator can be read as"the address of" so &age means address of variable age.

62.When and who developed the C language?
In 1970s at AT&T Bell laboratories by Dennis Ritchie.

63.What is assembly Language?
Modified form of machine level language called assembly language.In assembly language instructions are given in english like words such as MOV,SUB etc.so it is easier to write and understand .

64.What is role of translators?
We know that computer can only understand machine language,which is in binary code 0or 1.The code written in high level and low level language should be translated into machine language and translator are used for this purpose.

65.What are the advantages of the functions?
• It reduces the complexity in a program by reducing the code
• Function are easily understanding and reliability and execution is faster
• It also reduces the time to run a program.In other way, Its directly proportional to complexity
• It’s easy to find-out the errors due to the blocks made as function definition outside the  main function.

66.What is else if ladder?
The else if ladder helps select one out of many alternative blocks of statements for execution depending on the mutually exclusive conditions

67.What is predefined function?
function which is already written,compiled&linked together with our program at time of linking called predefined function.

68.What is the difference between arrays and pointers?
Array is collection of similar datatype. it is a static memory allocation means we can not increment and decrement the arry size once we allocated. and we can not increment the base address, reassign address.
Pointer is a dynamic memory allocation. we can allocate the size as we want, assigning into another variable and base address incrementation is allowed.






              C INTERVIEW ASKED QUESTION -ANSWER



1.Why C Language?
C is one of the high level languages. It is a general purpose language, which means it can be used to write programs of any sort.

2.What are the advantages of c language?
• Easy to write
• Rich set of operators and functions that are built–in
• Support for bit–wise operation
• Flexible use of pointers
• Direct control over the hardware
• Ability to access BIOS/DOS routines
• Interacting using Interrupts
• Ability to write TSR programs
• Ability to create .COM files
• Ability to create library files (.LIB)
• Ability to write interface programs

3.What are the disadvantages of c language?
• C is considered difficult to learn
• Because of its conciseness, the code can be difficult to follow
• It is not suited to applications that require a lot of report formatting and data file
manipulation

4.What are the salient features of c languages?
• The following are the salient features of C language are :
• C is called a middle level language
• C supports structured design approach
• C is extensible
• C is rich in data types and operators
• C is portable

5.What is C token?
The smallest individual units of a C program are known as tokens.

6.List the different types of C tokens?
• Constants
• Identifiers
• Keywords
• Operators
• Special symbols
• Strings

7.What is string?
A string is a sequence of characters ending with NULL. It can be treated as a one–dimensional
array of characters terminated by a NULL character.

8.What is NULL character?
The NULL character is an escape sequence with ASCII value 0 and is different from the ASCII character'0'.

9.What is Pointer?
Pointer is a variable which store the address of other variable.Since pointer is a variable it has also its address.

10.What is Array?
Array is collection of multiple member of same type,stored in consecutive locations.Array can have more than one dimension.One dimension array is known as vector and two dimensional array is known as matrix.

11.What is Function?
Function is collection of statement which are use in order to perform specific task or operation.

12.Why we use Variable?
Variable is a identifier which are use for store and modify the data.

13.What is a Constant?
A constant is a value that does not change during the program execution. A constant used in
C does not occupy memory.

14.What are global variables?
Global Variables are those, which are required to be acccessed by all the functions defined after their declaration. So, the variables declared before the main {) can be acccessed by all the functions, which follow their declaration.
or ,you can say it in simple word a variatble which are declare outside the function is known as global variable .Global variable is store in data section of memory

15.What is a keyword?
Keywords are those words of C which have predefined meaning assigned by the C language.They form a part of the database required by the C compiler.or you can also state as keyword are the word whose meaning has already explained to the C compiler.

16.Give the rules for variable declaration?
• The rules for variable declaration in C are given below :
• A variable name consists of alphabets, digits and the underscore (_) character
• The length of variable should be kept upto 8 characters though your system may allow
upto 40 characters
• They must begin with an alphabet
• Some systems also recognize an underscore as the first character
• White space and commas are not allowed
• Any reserved word (keyword) cannot be used as a variable name.

17.What is data types?
Data types refer to the classes of data that can be manipulated by C programs. The three fundamental data types supported by C are character, integer and real type.

18.What is Recursion?
Recursion may be defined as when a function calling itself is known as recursion funtion.

19.Give the type of storage classes in C.
a)Automatic storage class.
b)Register storage class.
c)Static storage class.
d)External storage class.

20.What is difference between while and do-while?
In case of while first check condition given if true then loop execute if false then loop will not execute.But in case of do-while atleast one time loop will execute then after it check the condition.

21.Rule for constructing Real constant.
a)A real constant must have at least one digit.
b)It must have a decimal point.
c)It could be either positive or negative.
d)Default sign is positive.
e)No comma or blanks are allowed within a real constant.

22.What is data types?
Data types refer to the classes of data that can be manipulated by C programs. The three fundamental data types supported by C are character, integer and real type.

23.What are the different types of errors?
• Compile–Time Errors
• Linker Errors
• Runtime Errors
• Logical Errors

24.What are the type of data type in C?

  • float
  • integer
  • double
  • character
  • void
25.What is break statement?
When a break is encountered inside a loop, the loop is terminated and the control passes to
the statement following the body of the loop.

26.What is goto statement?
This is an unconditional control statement that transfers the flow of contorl to another part of the program.

27.what is continue statement?
The  continue statement is used when we want to go to the next iteration of the loop after skipping some statement of the loop.

28.What is the difference between break and continue statement?
The difference between break and continue is that when break is encountered the loop terminates and the control is transferred to the next statement following the loop,but when a continue statement is encountered the loop is not terminated and the next iteration of the loop starts.

29.What is nesting of loops?
When a loop is written inside the body of another loop,it is known as nesting of loops.

30.What is loop?
Loops are used when we want to execute a part of the program or a block of statements several times.

31 .What is macro?
The second preprocessor function is macro definition. A macro is formal syntax that can be used to generate statements for use in a program. For the C language, the macro generates C statements.

32.What is the difference between c &c++?
c++ is an object oriented programing but c is a procedure oriented programing.c is super set of c++. c can't suport inheritance,function overloading, method overloading etc. but c++ can do this.In c-programe the main function could not return a value but in the c++ the main function should return a value

33.What is friend function?
The function declaration should be preceded by the keyword friend.The function definitions does not use either the keyword or the scope operator :: The functions that are declared with the keyword friend as friend function.Thus, a friend function is an ordinary function or a member of another class

34.What is the use of getchar() function?
It returns a character just entered from the standard input unit, that is, keyboard. The entered character can be either assigned to a character variable or echoed to the computer screen.

35.What is the difference between single charater constant and string constant?
• A single character constant consists of only one character and it is enclosed within a
pair of single quotes.
• A string constant consists of one or more characters and it is enclosed within a pair of
double quotes.

36.What is numeric constant?
Numeric constants consist of numeric digits ,they may not have decimal points(.).

37.What is real constant?
Real constants are numeric constants that contain decimal point.

38.What is Whitespace character?
Space character ,newline characterhorizontal tab,vertical tab,and form feed are known as Whitespace character.

39.What are the different categories of functions in C?
• In C, the functions can be divided into the following categories :
• Functions with no arguments and no return values
• Functions having arguments but no return values
• Functions having arguments and return values also

40.What is compiler?
The compiler converts high lev el code to machine's assembly language code.

41.What is memory layout of C program?

  • text or code segment
  • initialized data segment
  • uninitialized data segment
  • stack
  • heap(unreserved section of memory)
42.What is signed and unsigned?

A numeric value, may have a positive or a negative sign. In the memory, for a variable, one bit is used exclusively to maintain the sign of the data. If we don't have sign, the sign bit also may be used for data. If the value is negative, the sign bit is 1, and if it is positive, it will be 0.

43.What is Lvalue require?
When the leftside value is not assigned then the Lvalue error occured.

44.What is typecasting?
Temporary change the type of data is known as typecasting.

45.What is the use of typedef?
The typedef help in easier modification when the programs are ported to another machine.A descriptive new name given to the existing data type may be easier to understand the code.

46.What is type of typecasting?

  • Implicit typecasting
  • Explicit typecasting
47.What is meant by type specifiers?

Type specifiers decide the amount of memory space occupied by a variable. In the ease of integral types; it also explicitly states the range of values that the object can hold..

48.What are the types of type specifiers?
• The available data type specifiers are :
• Short
• Long
• Signed
• Unsigned

49.What is heap section of memory?
Unreserved area of the memory is known as heap section.

50.What is masking?
Masking is a process in which a given bit pattern is partly extracted into another bit pattern by means of a logical bitwise operation

51.What is getch() function?
It returns a character just entered from the standard input unit. The entered character is not echoed on the screen. It reads a single character the moment it is typed without waiting for the Enter key to be hit.

52.What is putchar() function?
It prints the character constant or the character variable to the standard output device. The function putchar( ) has the following form : putchar (var name)

53.What is the use of bitwise operator?
The bitwise operator performs the operation on bits (i.e. bit by bit). Using the bitwise operators we can set / reset / check any bit in the value of the variable.

54.What is unary operator?
The operators that act upon a single operand to produce a new value are known as unary operators.

55.What is macro?
A macro is a fragment of code which has been given a name.Whenever the name is used,it is replace by the content of the macro

56.List the different type of C tokens.

  • identifier
  • keywords
  • variable
  • constants
  • operators
57.What is need of formate identifier?

To inform printf and scanf .printf for output and scanf for input.

58.What is local block?
A local block is any portion of C program that is enclosed by the left brace({) and the right brace(}).

59.What are the types of unary operators?
• C support unary operators are :
• minus operator -
• increment operator + +
• decrement operator –
• size operator
• (type) operator

60.What is fuction of Linker?
All program written in C use library function which is precompiled and their object code is stored in library file with .lib extension .Linker combine object code of library function with the object code of our program.

61.What is address operator?
It is given as' &' which returns the address of a variable when placed before it.This operator can be read as"the address of" so &age means address of variable age.

62.When and who developed the C language?
In 1970s at AT&T Bell laboratories by Dennis Ritchie.

63.What is assembly Language?
Modified form of machine level language called assembly language.In assembly language instructions are given in english like words such as MOV,SUB etc.so it is easier to write and understand .

64.What is role of translators?
We know that computer can only understand machine language,which is in binary code 0or 1.The code written in high level and low level language should be translated into machine language and translator are used for this purpose.

65.What are the advantages of the functions?
• It reduces the complexity in a program by reducing the code
• Function are easily understanding and reliability and execution is faster
• It also reduces the time to run a program.In other way, Its directly proportional to complexity
• It’s easy to find-out the errors due to the blocks made as function definition outside the  main function.

66.What is else if ladder?
The else if ladder helps select one out of many alternative blocks of statements for execution depending on the mutually exclusive conditions

67.What is predefined function?
function which is already written,compiled&linked together with our program at time of linking called predefined function.

68.What is the difference between arrays and pointers?
Array is collection of similar datatype. it is a static memory allocation means we can not increment and decrement the arry size once we allocated. and we can not increment the base address, reassign address.
Pointer is a dynamic memory allocation. we can allocate the size as we want, assigning into another variable and base address incrementation is allowed.




No comments:

Contact Form

Name

Email *

Message *