C Interview Question | Set-1
1) How do you make increment statement or decrement statement in c?
There are two ways you can do this. One increment operator ++ and decryption operator -. For example, a "x ++" statement is an increase of the value of x by 1. Now Lets see similarly in the "x -" This statement means reducing the value of x to 1. Another way to write incremental statements is to use traditional + plus. Signature or - minus sign. In the case of "x ++", another way to writing is "x = x +1".
2) What is the difference between a call by value and a call by difference?
When using a value by call, you are sending the value of the variable as a parameter to a function, while the call by reference sends the address of the variable. Furthermore, under call by value, the value is not affected by any operational parameter, but in the case of call by reference, the values are affected by the process in the function.
3) Some coders debug their programs by placing comment icons on certain codes instead of deleting them. How does this help in debugging?
Comment icons around the code, also known as "commenting", are a way to isolate certain codes that you think may have errors in the program, without removing the code. . If the code is really correct, you can remove the comment icons and continue. If you remove it for the first time, it will save you time and effort to rewrite the code.
4) Write an equivalent code for the following statement in WHILE LOOP format?
for (a=1; a<=100; a++)
printf ("%d\n", a * a);
Answer:
a=1;
while (a<=100) {
printf ("%d\n", a * a);
a++;
}
5) What is a stack?
Stock is a form of data structure. Data is stored in stacks using the FILO (first to last) approach. In any particular case, only the top of the stack can be accessed, which means that in order to retrieve the data stored inside the stack, the top must first be extracted. Storing data in stock is also called push, and data retrieval is referred to as POP.
6) What is a sequential access file?
When programs store and retrieve data in a file, it is possible to rename the file in various forms. Sequential access file means that the data is saved chronologically: one after the other is placed in a data file. In order to access a specific piece of data in a sequential access file, one must read the data all at once until the correct one is reached.
7) What is the variable initialization and why is it important?
It refers to the process of assigning an initial value to a variable before it is used in the program. Without initialization, the variable will have an unknown value that will cause unexpected output when used in calculations or other functions.
8) What is Spaghetti Programming?
Spaghetti programming refers to complex and overlapping codes throughout the program. This constructive approach to coding is usually due to the inexperience of the programmer. Spaghetti programming complicates a program and codes are difficult to analyze, so avoid them as much as possible.
Also See :
0 Comments
If you have any doubt, Please let me know.