Thursday, 6 February 2014

C Interview Questions and Answers - 3


See the Complete C tutorial Here


41) What is the difference between single character 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.



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 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



44) What is this pointer?


It is a pointer that points to the current object. This can be used to access the members of the current object with the help of the arrow operator


45) What is zero based addressing?


The array subscripts always start at zero. The compiler makes use of subscript values to identify the elements in the array. Since subscripts start at 0, it is said that array uses zero-based addressing.


46) What is a loop?


A loop is a process to do a job repeatedly with possibly different data each time. The statements executed each time constitute the loop body, and each pass is called iteration. A condition must be present to terminate the loop.


47) What are the types of data types and explain?
There are five basic Data types in C. These are :
void : means nothing i.e. no data involvement in an action
char : to work with all types of characters used in computer operations
int : to work with an integer type of data in any computational work
float : to work with the real type of data or scientific numbers in the exponential form
double : to work with double precision of numbers when the approximation is very crucial.



49) 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.



50) 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.


51) What is a pointer? 


A pointer is a variable that represents the location (rather than the value) of a data item, such as a variable or an array element. It is a variable that holds a memory address. This address is the location of another variable or an array element in memory.



52) How to declare pointer variables?


If a variable is going to be a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name. The general form for declaring a pointer variable is data _type * var_ name;




53) What is the difference between fread buffer() and fwrite buffer()?


Fread(), buffer is a pointer to an area of memory that will receive the data from the file. For fwrite(), buffer is a pointer to the information that will be written to the file. The value of count determines how many items are read or written, with each item being num_byte bytes in length. The size_t in both the formats is defined as some kind of unsigned integer. Finally, fp is a file pointer to a previously opened file.



54) 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.



55) What are the types of I/O functions?
I/O functions are grouped into two categories :
Unformatted I/O functions
Formatted I/O functions



56) What is the difference b/w formatted & unformatted I/O functions?


The formatted I/O functions allow programmers to specify the type of data and the way in which it should be read in or written out. On the other hand, unformatted I/O functions do not specify the type of data and the way is should be read or written.



57) How to declare pointer variables?


If a variable is going to be a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name. The general form for declaring a pointer variable is data _type * var_ name;


58) 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 support inheritance,function overloading, method overloading etc. but c++ can do this.In c-program the main function could not return a value but in the c++ the main function should return a value.


59) What is the use of putchar function?


The putchar function displays one character on the display monitor. The character to be displayed is of type char. The syntax for putchar function is as given below :putchar (ch_var);
Where ch_var is a previously declared character variable.



60) What is the use of getchar functions?


The getchar function accepts a single character from the keyboard. The function does not require any arguments, though a pair of empty parentheses must follow the word getchar as a syntax. It returns a single character from a standard input device (typically a keyboard ) and it can be assigned to predeclared character variable.



1  2  3  4  5


See the Complete C tutorial Here

Get Ebooks delivered to your email id

Comments

Subscribe to our channel

Facebook

Powered by Blogger.

Home | Contact Us | DMCA | Terms of Service | Privacy | Advertise

Maven Scientists