Wednesday 23 September 2015

Most recent asked C Language Interview Questions and Answers

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

More Questions & Answers:-

No comments:

Post a Comment