InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How to get string length of given string in C? |
| Answer» | |
| 2. |
Write a program to find the biggest number of three numbers in C? |
| Answer» | |
| 3. |
How we can insert comments in a C program? |
|
Answer» Comments are an AMAZING way to insert remarks in a program that can serve as a reminder of what a given program is all about. Get more knowledge of this topic if you are preparing for Interview QUESTIONS on C. You can also add a DESCRIPTION of why a certain function or code was placed in the first place. Comments begin with /* and end by */ characters. Comments can be single or several lines and can be placed anywhere in the C program. |
|
| 4. |
Explain the difference between #include "..." and #include in C? |
|||||||||
Answer»
|
||||||||||
| 5. |
Explain the difference between structs and unions in C? |
|||||||||||||||
Answer»
|
||||||||||||||||
| 6. |
What are the string functions? List some string functions available in C. |
|
Answer» Strings are an array of characters that END with a null character (‘\0’). The presence of null character SPECIFIES the end of a string. Remember, strings should always be ENCLOSED by DOUBLE quotes. Most used functions in the string library are listed below:
|
|
| 7. |
What is the purpose of main( ) in C language? |
|
Answer» The main() function is the entry point in C PROGRAMMING LANGUAGE. This function is called by OS the moment a user runs a program. The purpose of this function is crucial because the EXECUTION of a C program starts from here. Without the main() function, you cannot execute a program. |
|
| 8. |
Write a program to print numbers from 1 to 100 without using loop in C? |
| Answer» | |
| 9. |
Write a program to generate random numbers in C? |
| Answer» | |
| 10. |
What is modifier & how many types of modifiers available in C? |
|
Answer» The modifier is a prefix for a basic DATA TYPE that is USED for indicating the modification required in the storage space allocated to the variable. A total of five modifiers are available in C programming – SHORT, Long, Signed, Unsigned, and long. This information is critical for Embedded C Interview QUESTIONS. |
|
| 11. |
Explain the difference between ++u and u++? |
|||||||||
Answer»
|
||||||||||
| 12. |
How many types of errors are there in C language? Explain |
|
Answer» This is a TYPICAL Embedded C Interview Questions. There are THREE error types in C language – Runtime, Compile and Logical. Runtime errors may OCCUR when the PROGRAM is being run, usually due to illegal operations performed. Compile errors occur during the compilation of the program. Compile errors are of two types- Syntax and Semantic. Logical errors occur in the output due to errors in the logic applied in the C program. |
|
| 13. |
Explain data types & how many data types supported by C? |
|
Answer» In C language, DATA types mean an extensive SYSTEM that is used for declaring the functions or variables of different types. The KIND of a variable used will determine how much space it will occupy in the storage and how the stored bit pattern will be interpreted. Some of basic data types in C are: |
|
| 14. |
What do you mean by keywords in C? |
|
Answer» Certain reserved words in C, which are known and understood by the compiler are called keywords. The meaning of these keywords is already known to the compiler. Keywords are always written in SMALL CASE LETTERS, and cannot be used as the names of variables as that may change their meaning. Some of the standard keywords are – AUTO, case, break, FLOAT, extern, etc. |
|
| 15. |
Write a program to reverse a given number in C language? |
| Answer» | |
| 16. |
Write a program to check whether a number is prime or not using C? |
| Answer» | |
| 17. |
Write a program to swap two numbers without using third variable in C? |
| Answer» | |
| 18. |
Explain the difference between getch() and getche() in C? |
| Answer» | |
| 19. |
In C language can we compile a program without main() function? |
|
Answer» Yes, it is possible to compile a program in C without the main function, but it will not GET executed. This is because the execution starts only from the main function. This function is the ENTRY point of every program in C. All pre-defined or user-defined FUNCTIONS are directly or indirectly called through the main function. |
|
| 20. |
What is structure in C language? |
|
Answer» Structures are a COLLECTION of various DATA ITEMS of different data-types. Like an ARRAY, each member in a STRUCTURE is located next to each other. |
|
| 21. |
Explain the difference between malloc() and calloc() in C? |
|||||||||
Answer»
|
||||||||||
| 22. |
What is static memory allocation? Explain |
|
Answer» It is the allocation of memory at the time of compilation before the ASSOCIATED program gets EXECUTED. Unlike DYNAMIC or automatic memory allocation, where memory gets allocated as required at RUN time, this TYPE of memory gets allocated by the compiler at the time of compilation. |
|
| 23. |
What is pointer & why it is used? |
|
Answer» The pointer is nothing but a variable that stores and points the address or location of a different variable. While a regular variable stores the VALUE of a variable, a pointer variable stores the address or location of a variable. Why it is used?You can USE pointers in a C program for getting the location of a variable, or for achieving pass by call reference. This is because pointers ALLOW various functions to modify and share the local variables. You can ALSO use a pointer for implementing “linked” data structures, such as lists and binary trees. Have you read our REST of the Interview Questions on C? |
|
| 24. |
What do you mean by recursion in C? |
|
Answer» Recursion is a function that calls itself. It is EASY to write in the program, but it requires a lot of MEMORY space and execution time. The ADVANTAGE of using recursion is that developers can avoid unnecessary calling of functions by SUBSTITUTING with iteration. |
|
| 25. |
Explain the difference between call by value and call by reference in C language? |
|||||||||||||||
Answer»
|
||||||||||||||||
| 26. |
Explain the difference between the local variable and global variable in C? |
|||||||||||||||
Answer»
|
||||||||||||||||
| 27. |
Explain why C is faster than C++? |
||||||||||||
|
Answer» 17. Explain the term PRINTF() and scanf() USED in C language?
|
|||||||||||||
| 28. |
Lists the benefits of C programming language? |
|
Answer» One of the biggest benefits of learning the C language is that it is recognized worldwide and used in hundreds and THOUSANDS of applications worldwide, including scientific OPERATING systems. This language combines the features of HIGH end and basic languages. As a result, you can freely USE it for starter-level programming as well as high-level programming such as scripting for COMPLEX applications. |
|
| 29. |
Who developed C language and when? |
| Answer» | |
| 30. |
What is C language & why it is used? |
|
Answer» C is a robust, powerful and fast general-purpose programming language.C is a robust language with a rich set of built-in features and functions that can be used to build any complex WEB program. The C compiler has the POTENTIAL of an assembly language and functionalities of a high-end language. Why it is used?Developers can use C language for developing SYSTEM applications that are FORMING a huge PORTION of OS such as Windows, Linux, and UNIX. Most of the OS, C compiler and application programs in UNIX today are written in C. |
|
| 31. |
What are control structures? What are the different types? |
|
Answer» These structures are statements that are used to CONTROL the flow and direction of the execution of a PROGRAM in C. It brings together instructions and LOGICAL UNIT. Control structures have two main classes - conditionals and loops. There are three different types of control structures are - Selection, Sequence, and Repetition. |
|
| 32. |
Explain logical errors? Compare with syntax errors. |
||||||||||||
Answer»
|
|||||||||||||
| 33. |
Compare interpreters and compilers. |
||||||||||||
Answer»
|
|||||||||||||
| 34. |
What do you mean by dynamic memory allocation in C? What functions are used? |
|
Answer» It refers to the MECHANISM by which storage or MEMORY gets allocated DYNAMICALLY to variables during the RUNTIME. This mechanism uses malloc(), and calloc() functions to allocate memory dynamically. free() function is used to release dynamically allocated memory. |
|
| 35. |
What is an array? What the different types of arrays in C? |
|
Answer» An Array is a group of elements having similar data TYPES under a common NAME. In an array, the two-dimensional elements are stored in ROWS as per the memory locations. An element's array name represents the address of that element. It MUST be noted that the SIZE of size is always constant and never a variable. In C language, there are two types of arrays - Single Dimensional Array and Multi-Dimensional Array. |
|
| 36. |
Why is C called "mother" language? |
|
Answer» C is often referred to as the mother of all programming language because it is one of the most POPULAR programming LANGUAGES. RIGHT from the time, it was developed, C has BECOME the most widely used and preferred programming languages. Most of the compilers and kernels are written in C today. |
|
| 37. |
How is actual parameter different from the formal parameter? |
||||||||||||
Answer»
|
|||||||||||||
| 38. |
Why are algorithms important in C program? |
|
Answer» It is a mandatory step to CREATE an algorithm before writing any program in C. An algorithm gives step-by-step GUIDELINES on how a SOLUTION can be achieved and also serves as a blueprint on how a program should start or end, including what PROCESSES and computations must be INVOLVED. |
|
| 39. |
How is = symbol different from == symbol in C programming? |
|||||||||
Answer»
|
||||||||||
| 40. |
Differentiate abs() function from fabs() function. |
||||||||||||
Answer»
|
|||||||||||||
| 41. |
What are local static variables? How can you use them? |
|
Answer» A local static variable gets defined in a specific BLOCK and is accessible locally INSIDE that block only. However, because it is static, its value is persistent. Its lifetime does not end when a function call is declared. Instead, its lifetime EXTENDS throughout the PROGRAM. Local static variables can be used for counting the number of times a particular function is called. |
|