Function Argument Variables In C Programming Job Interview Question and Answers

1. What is the purpose of main() function?
Answer:-main() is the user-defined function. main() is the first function in the program, which gets called when the program executes. The startup code contains runmain() function, which calls main() function, we can't change the name of the main() function.

Function Programming In C
Programming Twenty Interview Questions
C Viva Questions for Engineering Freshers
Function And Pointers

2. What is an argument? Differentiate between formal arguments and actual arguments?
Answer:-The actual arguments are the arguments with which the function can be called. The formal arguments are the arguments with which the function can be defined. In simple words, function call contains actual arguments and function definition contains formal arguments.



3. What is the difference between character array and string in C?
Answer:-The major difference between the char array and the string is that the array will not end with the null, whereas string ends with the null.

4. Is it possible to print colors with printf statements?
Answer:-Yes, there are already ready made functions in header file conio.h
textcolor(5) will change the color to the pink. Similarly by changing the value we get different colors.

5. What is the type of the variable b in the following declaration?
#define FLOATPTR float*
FLOATPTR a, b;

a) float
b) float pointer
c) int
d) int pointer
Answer:-float-The statement FLOATPTR a,b; becomes float* a,b; Here "a" is a float pointer, but "b" is just an float variable, so the correct type for "b" is "float", and not "float-pointer". The above problem demonstrate the drawback of using #define constant. To avoid this situation use typedef's in place of #define.

6. How can you determine the maximum value that a numeric variable can hold?
Answer:-The correct way is to include <limits.h> and use the defined macros such as INT_MIN and INT_MAX, which define the minimum and maximum values, which the type can hold.In terms of designing your code, it helps to know that C imposes "minimum maximums" - e.g. a signed char must be able to hold _at least_ the values -127 to 127; a signed int must be able to hold _at least_ the values -32767 to 32767 and so forth.Be wary of assuming that because a type is N bits wide, it can store 2N-1 possible values; there is absolutely no guarantee this is true.

7. Why C is not platform dependent?
Answer:-Let us take example of Linux and Windows to explain this.
We say that C is platform dependent because
1. If you compile and build a C program code in windows, copy that .exe file to a Linux machine, that .exe file will not run there.
2. In the same way if you compile the same program code on Linux, you'll get a .out file which will not run on windows if directly copied there.

8. What is the maximum length of command line arguments including space between adjacent arguments?
Answer:- The C language standard does not impose any maximum on command line length / number of command-line arguments (not that I could find after a cursory search, anyway); the command-line shell is usually the limiting factor in this sort of thing.

9. Which one is correct answer?
  1. C is a low level language
  2. C is a middle level language
  3. C is a high level language
Answer:- C is a middle level language. As C language contains both the features of high-level language and low-level languages. C can also be called as structured programming language.

10. Is it possible to write a C program without semicolons?
Answer:-
// Program For Finding Squar Of A NUmber
 #define Squar(x) (x*x)
void main()
{
while (!printf("Squar Of 2 Is %d", Squar(2))) {
}
}

Related

Variables in C 8142686542305346536

Post a Comment

  1. You have done very good job by creating collection for programming related Q&A.It will really help college going students and their Teachers alike.

    ReplyDelete

SPAMMING will not be Appreciated.

emo-but-icon

Hot in week

Recent

Comments

Our Channel

Contact Us

Name

Email *

Message *

Follow by Email

item