C Interview Question | Set-3
16) Compare and contrast the compilers from interpreters.
Compilers and translators often deal with the way system codes are made. The interpreters decipher the program codes one line at a time, while the compilers take the entire program and convert it into object code, before installing it. The important difference here is that in the case of translators, the system may encounter syntax errors during execution, and will stop there. On the other hand, compilers check the syntax of the entire system and will continue to do so only when syntax errors are not found.
17) How do you declare a variable that will hold an string values?
The char key name can only hold 1 character at a time. By creating a list of characters, you can save string values in it. Example: "char MyName [50];" means a flexible line named MyName that can hold up to 50 characters.
18) Can curly brackets {} be used to insert a single line of code?
While curly brackets are mainly used to combine several lines of code, they will still work flawlessly if you use one line. Some programmers prefer this method as a way of editing the code to make it look clear, especially in conditional statements.
19) What are the main files and how are they used in C programs?
Header files are also known as book files. They contain two important elements: definitions and prototypes of the functions used in the programs. Simply put, the commands that you use in C programs are actually the functions defined within the files per head. Each header file contains a set of tasks. Example: stdio.h is a header file containing specifications and command statistics such as printf and scan.
20) What is the syntax error?
Syntax errors are associated with errors in using the programmed language. Maybe a written command or command that should be put in a small mode but instead put in a character with a high guilt. Invalid symbol, or missing symbol, somewhere within the line of code could lead to syntax error.
21) What are variables and what way is it different from constants?
The variables and directions may appear similar in the sense that both of these identifiers are composed of one or more characters (letters, numbers and a few valid characters). Both will hold a certain amount. Values held by a variable can be adjusted throughout the system, and used for multiple operations and mathematical integrations. Constants were given prices only one time, placed at the beginning of the program. This value is not changed in the system. For example, you could assign a standard PI called PI and give it a value of 3.1415. You can use it as a PI in the system, instead of typing 3.1415 each time you need it.
22) How do you reach values within an array?
Arrival contains many items, depending on the size you provided at the time of the dynamic announcement. Each item is given a number from 0 to 1-item numbers. To assign or retrieve the value of a particular feature, refer to the member number. For example, if you have a declaration of "intscores [5];" - then you have 5 accessible features, namely: schools [0], schools [1], schools [2], schools [3] and schools [4]].
23) Can I use the "int" data type to store the value of 32768? Why?
No. The "int" type of data can store numbers from 32768 to 32767. To save 32768, you can use "long int" instead. You can also use "unregistered int", assuming you do not intend to keep incorrect values.
24) Can two or more operators such as \ n and \ t be integrated into a single line of code?
Yes, it works perfectly to integrate operators, especially if the need arises. For example, you can have a code like "Print (" Hello \ n \ n \ 'World \' ")" to extract the text "hello" from the first line and then "Earth" to be included in one of the quotes that will follow the next two lines.
25) Why are not all head files announced in all C programs?
The choice of declaring a header file at the top of each C program will depend on which commands / functions you will be using in that program. Since each header file contains descriptions of different functions and prototype, you will be using only those header files that contain the functions you will need. Announcing all key files throughout the program will only increase file size and program load, and is not considered a good program style.
Also See :
0 Comments
If you have any doubt, Please let me know.