C Programming Interview Questions and Answers-3

Q: – What are stdin, stdout, and stderr?
In C, a file is treated as a series of bytes that is called file stream. stdin, stdout, and stderr are all pre-opened file streams. stdin is the standard input for reading; stdout is the standard output for writing; stderr is the standard error for outputting error messages.
Q: – What value is yielded by a relational expression?
A relational expression evaluates to either 0 or 1. If the relation indicated by a relational operator in an expression is true, the expression evaluates to 1; otherwise, the expression evaluates to 0.
Q: – Is the unary minus operator (-) the same as the subtraction operator (-)?
No, they are not the same, although the two operators share the same symbol. The meaning of the symbol is determined by the context in which it appears. The unary minus operator is used to change the sign of a numeric value. In other words, the unary minus operator yields the negation of the value. The subtraction operator is an arithmetic operator that performs a subtraction between its two operands.
Q: – Why do we need the sizeof operator?
The sizeof operator can be used to measure the sizes of all data types defined in C. When you write a portable C program that needs to know the size of an integer variable, it’s a bad idea to hard-code the size based on the machine you are currently using. The better way to tell the program the size of the variable is to use the sizeof operator, which yields the size of the integer variable at runtime.
Q: – What can the %lu format specifier do?
The %lu format specifier can be used in a printf() string to convert the corresponding argument to the unsigned long int data type. In addition, the %lu format specifier is equivalent to %Lu.
Q: – What are the left and right values?
The left value is the address of a variable, and the right value is the content stored in the memory location of a variable.
Q: – How can you obtain the address of a variable?
By using the address-of operator, &.
Q: – Can a null pointer point to valid data?
No. A null pointer cannot point to valid data. This is because the value contained by a null pointer has been set to 0.
Q: – What can the null character do?
The null character (‘’) in C can be used to mark the end of a string.
Q: – Can a global variable be hidden by a local variable with block scope?
Yes

Tagged , . Bookmark the permalink.

One Response to C Programming Interview Questions and Answers-3

  1. Garry says:

    Great website. Lots of helpful information here. I am sending it to some friends and also sharing in delicious. And obviously, thank you in your effort!

Leave a Reply