Sunday , September 22 2019

C Programming Interview Questions Answers Part-I

64) What is the default value of local and global variables?

Local variables get garbage value and global variables get a value 0 by default.

[the_ad id=”2840″]

65) Can a pointer access the array?

Yes, Pointer by holding array’s base address can access the array.

66) What is wrong in this statement?  scanf(“%d”,whatnumber);

An ampersand “&” symbol must be placed before the variable name whatnumber. Placing & means whatever integer value is entered by the user is stored at the “address” of the variable name. This is a common mistake for programmers, often leading to logical errors.

67) What is a string length?

It is the count of character excluding the ‘\0’ character.

68) What are valid operations on pointers?

The only two permitted operations on pointers are

  • Comparison
  •  Addition/Subtraction (excluding void pointers)

69) What is the built-in function to append one string to another?

strcat() form the header string.h

70) Which operator can be used to access union elements if union variable is a pointer variable?

Arrow –> operator.

71) What is the purpose of #undef preprocessor?

It be used to undefine an existing macro definition.

72) What is recursion?

Function calling itself is called as recursion.

73) Which function can be used to release the dynamic allocated memory?

free().

74) What is the output file generated by the linker.

Linker generates the executable file.

75) What is the maximum length of an identifier?

Ideally it is 32 characters and also implementation dependent.

76) What is the default function call method?

By default the functions are called by value.

77) What is a constant pointer?

A pointer which is not allowed to be altered to hold another address after it is holding one.

78) What is difference between far and near pointers?

In first place they are non-standard keywords. A near pointer can access only 2^15 memory space and far pointer can access 2^32 memory space. Both the keywords are implementation specific and are non-standard.

79) Which control loop is recommended if you have to execute set of statements for fixed number of times?

for – Loop.

80) What is a constant?

A value which cannot be modified is called so. Such variables are qualified with the keyword const.

81) Can the main() function left empty?

Yes, possibly the program doing nothing.

82) Can one function call another?

Yes, any user defined function can call any function.

83) A part from Dennis Ritchie who the other person who contributed in design of C language.

Brain Kernighan

84) What is the equivalent code of the following statement in WHILE LOOP format?

85) In C programming, how do you insert quote characters (‘and “) into the output screen?

This is a common problem for beginners because quotes are normally part of a printf statement. To insert the quote character as part of the output, use the format specifiers (for single quote), and (for double quote).

86) What is the use of a ‘’ character?

It is referred to as a terminating null character, and is used primarily to show the end of a string value.

87) What is the modulus operator?

The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol. For example: 10 % 3 = 1, meaning when you divide 10 by 3, the remainder is 1.

About Umesh Lokhande

Umesh Lokhande holds a Master degree in Scientific Instrumentation from University of Applied Sciences Jena, Germany. and has previously worked at Orbotech, Alere Technologies etc. Umesh is also a founder and first author of BINARYUPDATES.COM

Login

Register | Lost your password?