C Language Interview Questions And Answers For Freshers Pdf



TCS Interview Questions: TCS full form is Tata Consultancy Services and it is a global leader in IT services. TCS offers best career opportunities for fresher’s as well as Experienced. TCS Recruits number of candidates every year through Campus recruitment and direct walk-in.

Dear Readers, Welcome to C Interview questions with answers and explanation. These 100 solved C Programming questions will help you prepare for technical interviews and online selection tests during campus placement for freshers and job interviews for professionals. After reading these tricky C questions, you can easily attempt the objective type and multiple choice type questions on C. We've created a monster resource of top 100 interview questions in c language and this PDF is free to download. This list of the op 100 Technical C Interview Questions and Answers is perfect for both freshers and experienced candidates as it covers a wide range of questions and topics.

Useful Links From This Website
Notifications, Admit Cards, Results, Universities
Books, Exam Pattern, Mock Tests, Study Materials, Syllabus, Test Papers

Dear readers, these C Programming Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of C Programming.As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they.

TCS Selection Process:

Selecting of Candidates for TCS will be done in 3 phases.

  • Written Test.
  • Technical Interview.
  • HR interview.

All are elimination rounds. We provide a wide collection for successful clearing of all the rounds. The aptitude which is the major part in the written test is provided. Follow the link Sample Quantitative Aptitude Questions.

Here we also provide wide collection of Technical Interview Questions and answers covering all the languages which will help a lot in clearing the Technical phase.

HR round TCS Interview Questions and Answers for Freshers

  • Tell us something about yourself/ Introduce yourself

This is the most frequently asked question almost every company. Answer to this question should be very brief covering your educational background, family details, achievements and goals etc.

C Language Interview Questions And Answers For Freshers Pdf
  • Why should we hire you for TCS?

Your answer should be in that way that it convinces him to select you. Mention all the skills you have which will meet their requirement. Also mention your achievements which add benefit to their company.

  • Who is the founder of TCS?

Jamsetji Nusserwanji Tata established TATA Group in 1869. However it was under Mr. Jahangir Ratanji Dadabhoy Tata (JRD Tata), that this group was expanded and hence TCS was established in 1968. Present Mr. Rattan Tata is the Chairman of the group.

  • Who is the present CEO?

Mr. Natarajan Chandrasekaran is the present Chief Executive Officer (CEO).

If you can’t answer these questions it creates impression that you have not done any home work regarding this.

  • Who are competitors for TCS?

A little study will help you answer this question which makes a positive sense to the interviewer that you are concerned with this job.

The major competitors for TCs are Infosys, Wipro, HCL, oracle, Tech Mahindra and Mphasis.

  • Are you willing to accept a bond of 2 years and to relocate?

The answer to this question is up to you based on your personal and family conditions. Be honest.

  • Why do you want to join TCS but no other companies?

Try to mention some of the positive factors such as Good work environment and career growth.

Ex: I heard from my friends that TCS has a very good work environment and career growth. More over TCS is one of the top IT companies. Never mention reasons like salary which creates negative impression.

  • If you are rejected today what will you do?

This question doesn’t mean that you are rejected. This is test your confidence and also to know what are your other plans and to know if you have applied for any other company.

  • Are you willing to work overtime and nights/weekends?

The answer to this question depends upon on one’s individual opinion and situations.

  • Do you have anything to ask me?

You may ask questions of this kind

  • what are the company policies regarding training?
  • can you explain a typical day in this role?
  • job description assigned to me be based on my interest area?
  • what are the personal growth opportunities such as leadership training
  • what is the training budget?

Few more questions would be like

  • Who inspired you to become an engineer?
  • Strengths and weaknesses
  • Are you a team player
  • Extra-curricular skills
  • What is more important money or job?
  • Dream job?
  • Certification of skills
  • Family background
  • About your native place

You can see more Interview questions and answers pdf and details of TCS Careers in this links.

Finally the perfect preparation with all the above provided materials along with TCS interview questions and proper presentation with confidence and a bit of luck will transform you from student TCS employee. All the best.

How to Download TCS Interview Questions as PDF File:

You can use the links in this post to download more interview questions. If you want to save these questions as pdf document the use the save as pdf file option in the print settings.

This is a nice initiative to educate the job aspirants and get them prepare for such big companies .The questions are the common ones but at personal level it is much difficult for Freshers to answer them . Thank you

C Introduction :-

C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. Although C was designed for implementing system software,it is also widely used for developing portable application software.C is one of the most widely used programming languages of all time and there are very few computer architectures for Explain Which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, Explain Which began as an extension to C.

C History :

Developed between 1969 and 1973 along with Unix
Due mostly to Dennis Ritchie
Designed for systems programming

  1. Operating systems
  2. Utility programs
  3. Compilers
  4. Filters

Original machine (DEC PDP-11) was very small :

  • 24K bytes of memory, 12K used for operating system
  • Written when computers were big, capital equipment
  • Group would get one, develop new language, OS

Characteristics of C :

1)Small size
2)Extensive use of function calls
3)Loose typing — unlike PASCAL
4)Structured language
5) Low level (BitWise) programming readily available
6)Pointer implementation – extensive use of pointers for memory, array, structures and functions.

C Program Structure :

A C program basically has the following form:
1)Preprocessor Commands
2)Type definitions
3)Function prototypes — declare function types and variables passed to function.
4) Variables
5)Functions

We must have a main() function.

C Language Interview Questions :-

1. What is C language?

C is a mid-level and procedural programming language. The Procedural programming language is also known as the structured programming language is a technique in which large programs are broken down into smaller modules, and each module uses structured code. This technique minimizes error and misinterpretation.

2. Why is C known as a mother language?

C is known as a mother language because most of the compilers and JVMs are written in C language. Most of the languages which are developed after C language has borrowed heavily from it like C++, Python, Rust, javascript, etc. It introduces new core concepts like arrays, functions, file handling which are used in these languages.

3. Why is C called a mid-level programming language?

C is called a mid-level programming language because it binds the low level and high -level programming language. We can use C language as a System programming to develop the operating system as well as an Application programming to generate menu driven customer driven billing system.

4. Who is the founder of C language?

Dennis Ritchie.

5. When was C language developed?

C language was developed in 1972 at bell laboratories of AT&T.

6. In C programming, Explain How do you insert quote characters (? and ?) into the output screen?

This is a common problem for beginners because quotes are normally part of a printf statement. To insert the quote character as part of the output, use the format specifiers ? (for single quote), and ? (for double quote).

7.What is the difference between the = symbol and symbol?

The = symbol is often used in mathematical operations. It is used to assign a value to a given variable. On the other hand, the symbol, also known as ?equal to? or ?equivalent to?, is a relational operator that is used to compare two values.

8. Which of the following operators is incorrect and why? ( >=, <=, <>, )

<> is incorrect. While this operator is correctly interpreted as ?not equal to? in writing conditional statements, it is not the proper operator to be used in C programming. Instead, the operator != must be used to indicate ?not equal to? condition.

9. Can the curly brackets { } be used to enclose a single line of code?

While curly brackets are mainly used to group several lines of codes, it will still work without error if you used it for a single line. Some programmers prefer this method as a way of organizing codes to make it look clearer, especially in conditional statements.

10. What are header files and Explain What are its uses in C programming?

Header files are also known as library files. They contain two essential things: the definitions and prototypes of functions being used in a program. Simply put, commands that you use in C programming are actually functions that are defined from within each header files. Each header file contains a set of functions. For example: stdio.h is a header file that contains definition and prototypes of commands like printf and scanf.

11. Can I use ?int? data type to store the value 32768? Why?

No. ?int? data type is capable of storing values from -32768 to 32767. To store 32768, you can use ?long int? instead. You can also use ?unsigned int?, assuming you don?t intend to store negative values.

12. Can two or more operators such as n and t be combined in a single line of program code

Yes, it?s perfectly valid to combine operators, especially if the need arises. For example: you can have a code like ? printf (?Hellonn?World??) ? to output the text ?Hello? on the first line and ?World? enclosed in single quotes to appear on the next two lines.

13. Why is it that not all header files are declared in every C program?

The choice of declaring a header file at the top of each C program would depend on Explain What commands/functions you will be using in that program. Since each header file contains different function definitions and prototype, you would be using only those header files that would contain the functions you will need. Declaring all header files in every program would only increase the overall file size and load of the program, and is not considered a good programming style.

14. When is the ?void? keyword used in a function?

When declaring functions, you will decide whether that function would be returning a value or not. If that function will not return a value, such as when the purpose of a function is to display some outputs on the screen, then ?void? is to be placed at the leftmost part of the function header. When a return value is expected after the function execution, the data type of the return value is placed instead of ?void?.

15. What are compound statements?

Compound statements are made up of two or more program statements that are executed together. This usually occurs while handling conditions wherein a series of statements are executed when a TRUE or FALSE is evaluated. Compound statements can also be executed within a loop. Curly brackets { } are placed before and after compound statements.

16. Write a loop statement that will sExplain How the following output:
1
12
123
1234
12345
[c]
for (a=1; a<=5; i++) {
for (b=1; b<=a; b++) printf(“%d”,b); printf(“n”); } [/c]

17. What is wrong in this statement?

scanf(?%d?,Explain Whatnumber); An ampersand & symbol must be placed before the variable name Explain Whatnumber. Placing & means Explain Whatever integer value is entered by the user is stored at the ?address? of the variable name. This is a common mistake for programmers, often leading to logical errors.

18. How do you generate random numbers in C?

Random numbers are generated in C using the rand() command. For example: anyNum = rand() will generate any integer number beginning from 0, assuming that anyNum is a variable of type integer.

19. What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

The most probable reason behind this error is that the header file for that function was not indicated at the top of the program. Header files contain the definition and prototype for functions and commands used in a C program. In the case of ?tolower()?, the code ?#include ? must be present at the beginning of the program.

20. What does the format %10.2 mean when included in a printf statement?

This format is used for two things: to set the number of spaces allotted for the output number and to set the number of decimal places. The number before the decimal point is for the allotted space, in this case it would allot 10 spaces for the output number. If the number of space occupied by the output number is less than 10, addition space characters will be inserted before the actual output number. The number after the decimal point sets the number of decimal places, in this case, it?s 2 decimal spaces.

21. What is wrong with this statement? myName = ?Robin?;

You cannot use the = sign to assign values to a string variable. Instead, use the strcpy function. The correct statement would be: strcpy(myName, ?Robin?);

22. How do you determine the length of a string value that was stored in a variable?

To get the length of a string value, use the function strlen(). For example, if you have a variable named FullName, you can get the length of the stored string value by using this statement: I = strlen(FullName); the variable I will now have the character length of the string value.

23. Is it possible to initialize a variable at the time it was declared?

Yes, you don?t have to write a separate assignment statement after the variable declaration, unless you plan to change it later on. For example: char planet[15] = ?Earth?; does two things: it declares a string variable named planet, then initializes it with the value ?Earth?.

24. What are the different file extensions involved when programming in C? Convert aae file to jpeg.

Source codes in C are saved with .C file extension. Header files or library files have the .H file extension. Every time a program source code is successfully compiled, it creates an .OBJ object file, and an executable .EXE file.

25. What are reserved words?

Reserved words are words that are part of the standard C language library. This means that reserved words have special meaning and therefore cannot be used for purposes other than Explain What it is originally intended for. Examples of reserved words are int, void, and return.

26. What are linked list?

A linked list is composed of nodes that are connected with another. In C programming, linked lists are created using pointers. Using linked lists is one efficient way of utilizing memory for storage.

27. What are binary trees?

Binary trees are actually an extension of the concept of linked lists. A binary tree has two pointers, a left one and a right one. Each side can further branch to form additional nodes, Explain Which each node having two pointers as well.

28. Not all reserved words are written in lowercase. TRUE or FALSE?

FALSE.

All reserved words must be written in lowercase; otherwise the C compiler would interpret this as unidentified and invalid.

29. What is wrong with this program statement?

void = 10; The word void is a reserved word in C language. You cannot use reserved words as a user-defined variable.

30. Is this program statement valid?

INT = 10.50; Assuming that INT is a variable of type float, this statement is valid. One may think that INT is a reserved word and must not be used for other purposes. Explain However, recall that reserved words are express in lowercase, so the C compiler will not interpret this as a reserved word.

31. What is a newline escape sequence?

A newline escape sequence is represented by the n character. This is used to insert a new line when displaying data in the output screen. More spaces can be added by inserting more n characters. For example, nn would insert two spaces. A newline escape sequence can be placed before the actual output expression or after.

32. What is output redirection?

It is the process of transferring data to an alternative output source other than the display screen. Output redirection allows a program to have its output saved to a file. For example, if you have a program named COMPUTE, typing this on the command line as COMPUTE >DATA can accept input from the user, perform certain computations, then have the output redirected to a file named DATA, instead of sExplain Howing it on the screen.

33. What is the difference between functions abs() and fabs()?

These 2 functions basically perform the same action, Explain Which is to get the absolute value of the given value. Abs() is used for integer values, while fabs() is used for floating type numbers. Also, the prototype for abs() is under , while fabs() is under .

34. Write a simple code fragment that will check if a number is positive or negative.

C Language Interview Questions And Answers For Freshers Pdf Sample

[c]

If (num>=0)
printf(“number is positive”);
else
printf (“number is negative”);
[/c]

35. What does the function toupper() do?

It is used to convert any letter to its upper case mode. Toupper() function prototype is declared in . Note that this function will only convert a single character, and not an entire string.

36. Which function in C can be used to append a string to another string?

The strcat function. It takes two parameters, the source string and the string value to be appended to the source string.

37. Do these two program statements perform the same output? 1) scanf(?%c?, &letter); 2) letter=getchar()

Yes, they both do the exact same thing, Explain Which is to accept the next key pressed by the user and assign it to variable named letter.

38. What is the difference between text files and binary files?

Text files contain data that can easily be understood by humans. It includes letters, numbers and other characters. On the other hand, binary files contain 1s and 0s that only computers can interpret.

39. is it possible to create your own header files?

Yes, it is possible to create a customized header file. Just include in it the function prototypes that you want to use in your program, and use the #include directive followed by the name of your header file.

40. What is dynamic data structure?

Dynamic data structure provides a means for storing data more efficiently into memory. Using dynamic memory allocation, your program will access memory spaces as needed. This is in contrast to static data structure, wherein the programmer has to indicate a fix number of memory space to be used in the program.

41. The % symbol has a special use in a printf statement. Explain How would you place this character as part of the output on the screen?

You can do this by using %% in the printf statement. For example, you can write printf(?10%%?) to have the output appear as 10% on the screen.

42. What are the advantages and disadvantages of a heap?

Storing data on the heap is slower than it would take when using the stack. Explain However, the main advantage of using the heap is its flexibility. That?s because memory in this structure can be allocated and remove in any particular order. Slowness in the heap can be compensated if an algorithm was well designed and implemented.

43. What are preprocessor directives?

Preprocessor directives are placed at the beginning of every C program. This is where library files are specified, Explain Which would depend on Explain What functions are to be used in the program. Another use of preprocessor directives is the declaration of constants.Preprocessor directives begin with the # symbol.

44. What will be the outcome of the following conditional statement if the value of variable s is 10?

s >=10 && s < 25 && s!=12 The outcome will be TRUE. Since the value of s is 10, s >= 10 evaluates to TRUE because s is not greater than 10 but is still equal to 10. s< 25 is also TRUE since 10 is less then 25. Just the same, s!=12, Explain Which means s is not equal to 12, evaluates to TRUE. The && is the AND operator, and follows the rule that if all individual conditions are TRUE, the entire statement is TRUE.

45. Describe the order of precedence with regards to operators in C.

Order of precedence determines Explain Which operation must first take place in an operation statement or conditional statement. On the top most level of precedence are the unary operators !, +, – and &. It is followed by the regular mathematical operators (*, / and modulus % first, followed by + and -). Next in line are the relational operators <, <=, >= and >. This is then followed by the two equality operators and !=. The logical operators && and || are next evaluated. On the last level is the assignment operator =.

46. What is wrong with this statement? myName = “Robin”;

You cannot use the = sign to assign values to a string variable. Instead, use the strcpy function. The correct statement would be: strcpy(myName, “Robin”);

47. How do you determine the length of a string value that was stored in a variable?

To get the length of a string value, use the function strlen(). For example, if you have a variable named FullName, you can get the length of the stored string value by using this statement: I = strlen(FullName); the variable I will now have the character length of the string value.

48. Is it possible to initialize a variable at the time it was declared?

Yes, you don’t have to write a separate assignment statement after the variable declaration, unless you plan to change it later on. For example: char planet[15] = “Earth”; does two things: it declares a string variable named planet, then initializes it with the value “Earth”.

49. Why is C language being considered a middle level language?

This is because C language is rich in features that make it behave like a high level language while at the same time can interact with hardware using low level methods. The use of a well structured approach to programming, coupled with English-like words used in functions, makes it act as a high level language. On the other hand, C can directly access memory structures similar to assembly language routines.

50. What are the different file extensions involved when programming in C?

Source codes in C are saved with .C file extension. Header files or library files have the .H file extension. Every time a program source code is successfully compiled, it creates an .OBJ object file, and an executable .EXE file.

C PROGRAMMING LANGUAGE Interview Questions and Answers :-

51. What are reserved words?

Reserved words are words that are part of the standard C language library. This means that reserved words have special meaning and therefore cannot be used for purposes other than Explain What it is originally intended for. Examples of reserved words are int, void, and return.

52. What are linked list?

A linked list is composed of nodes that are connected with another. In C programming, linked lists are created using pointers. Using linked lists is one efficient way of utilizing memory for storage.

53. What is FIFO?

In C programming, there is a data structure known as queue. In this structure, data is stored and accessed using FIFO format, or First-In-First-Out. A queue represents a line wherein the first data that was stored will be the first one that is accessible as well.

54. What are binary trees?

Binary trees are actually an extension of the concept of linked lists. A binary tree has two pointers, a left one and a right one. Each side can further branch to form additional nodes, Explain Which each node having two pointers as well.

55. Not all reserved words are written in lowercase. TRUE or FALSE?

FALSE. All reserved words must be written in lowercase; otherwise the C compiler would interpret this as unidentified and invalid.

56) Explain What is the difference between the expression “++a” and “a++”?

In the first expression, the increment would happen first on variable a, and the resulting value will be the one to be used. This is also known as a prefix increment. In the second expression, the current value of variable a would the one to be used in an operation, before the value of a itself is incremented. This is also known as postfix increment.

57. What would happen to X in this expression: X += 15; (assuming the value of X is 5)

X +=15 is a short method of writing X = X + 15, so if the initial value of X is 5, then 5 + 15 = 20.

58. In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

FALSE. C language is a case sensitive language. Therefore, NAME, name and Name are three uniquely different variables.

59. What is an endless loop?

An endless loop can mean two things. One is that it was designed to loop continuously until the condition within the loop is met, after Explain Which a break function would cause the program to step out of the loop. Another idea of an endless loop is when an incorrect loop condition was written, causing the loop to run erroneously forever. Endless loops are oftentimes referred to as infinite loops.

60. What is a program flowchart and Explain How does it help in writing a program?

A flowchart provides a visual representation of the step by step procedure towards solving a given problem. Flowcharts are made of symbols, with each symbol in the form of different shapes. Each shape may represent a particular entity within the entire program structure, such as a process, a condition, or even an input/output phase.

61. What is wrong with this program statement? void = 10;

The word void is a reserved word in C language. You cannot use reserved words as a user-defined variable.

62. Is this program statement valid? INT = 10.50;

Assuming that INT is a variable of type float, this statement is valid. One may think that INT is a reserved word and must not be used for other purposes. Explain However, recall that reserved words are express in lowercase, so the C compiler will not interpret this as a reserved word.

63. What are actual arguments?

When you create and use functions that need to perform an action on some given values, you need to pass these given values to that function. The values that are being passed into the called function are referred to as actual arguments.

64. What is a newline escape sequence?

A newline escape sequence is represented by the n character. This is used to insert a new line when displaying data in the output screen. More spaces can be added by inserting more n characters. For example, nn would insert two spaces. A newline escape sequence can be placed before the actual output expression or after.

65. What is output redirection?

It is the process of transferring data to an alternative output source other than the display screen. Output redirection allows a program to have its output saved to a file. For example, if you have a program named COMPUTE, typing this on the command line as COMPUTE >DATA can accept input from the user, perform certain computations, then have the output redirected to a file named DATA, instead of sExplain Howing it on the screen.

66. What are run-time errors?

These are errors that occur while the program is being executed. One common instance wherein run-time errors can happen is when you are trying to divide a number by zero. When run-time errors occur, program execution will pause, sExplain Howing Explain Which program line caused the error.

67. What is the difference between functions abs() and fabs()?

These 2 functions basically perform the same action, Explain Which is to get the absolute value of the given value. Abs() is used for integer values, while fabs() is used for floating type numbers. Also, the prototype for abs() is under , while fabs() is under .

68. What are formal parameters?

In using functions in a C program, formal parameters contain the values that were passed by the calling function. The values are substituted in these formal parameters and used in Explain Whatever operations as indicated within the main body of the called function.

69. What are control structures?

Control structures take charge at Explain Which instructions are to be performed in a program. This means that program flow may not necessarily move from one statement to the next one, but rather some alternative portions may need to be pass into or bypassed from, depending on the outcome of the conditional statements.

70. Write a simple code fragment that will check if a number is positive or negative.

If (num>=0)

printf(“number is positive”);

else

printf (“number is negative”);

If (num>=0)

printf(“number is positive”);

Ram

else

printf (“number is negative”);

71. When is a “switch” statement preferable over an “if” statement?

The switch statement is best used when dealing with selections based on a single variable or expression. Explain However, switch statements can only evaluate integer and character data types.

72. What are global variables and Explain How do you declare them?

Global variables are variables that can be accessed and manipulated anywhere in the program. To make a variable global, place the variable declaration on the upper portion of the program, just after the preprocessor directives section.

73. What are enumerated types?

Enumerated types allow the programmer to use more meaningful words as values to a variable. Each item in the enumerated type variable is actually associated with a numeric code. For example, one can create an enumerated type variable named DAYS whose values are Monday, Tuesday… Sunday.

74. What does the function toupper() do?

It is used to convert any letter to its upper case mode. Toupper() function prototype is declared in . Note that this function will only convert a single character, and not an entire string.

75. Is it possible to have a function as a parameter in another function?

Yes, that is allowed in C programming. You just need to include the entire function prototype into the parameter field of the other function where it is to be used.

76. What are multidimensional arrays?

Multidimensional arrays are capable of storing data in a two or more dimensional structure. For example, you can use a 2 dimensional array to store the current position of pieces in a chess game, or position of players in a tic-tac-toe program.

77. Which function in C can be used to append a string to another string?

The strcat function. It takes two parameters, the source string and the string value to be appended to the source string.

78. What is the difference between functions getch() and getche()?

Both functions will accept a character input value from the user. When using getch(), the key that was pressed will not appear on the screen, and is automatically captured and assigned to a variable. When using getche(), the key that was pressed by the user will appear on the screen, while at the same time being assigned to a variable.

79. What is the use of a semicolon (;) at the end of every program statement?

C Language Interview Questions And Answers For Freshers Pdf Format

It has to do with the parsing process and compilation of the code. A semicolon acts as a delimiter, so that the compiler knows where each statement ends, and can proceed to divide the statement into smaller elements for syntax checking.

80. What are structure types in C?

Structure types are primarily used to store records. A record is made up of related fields. This makes it easier to organize a group of related data.

81. What does the characters “r” and “w” mean when writing programs that will make use of files?

“r” means “read” and will open a file as input wherein data is to be retrieved. “w” means “write”, and will open a file for output. Previous data that was stored on that file will be erased.

82. What is the difference between text files and binary files?

Text files contain data that can easily be understood by humans. It includes letters, numbers and other characters. On the other hand, binary files contain 1s and 0s that only computers can interpret.

83. is it possible to create your own header files?

Yes, it is possible to create a customized header file. Just include in it the function prototypes that you want to use in your program, and use the #include directive followed by the name of your header file.

84. What is dynamic data structure?

Dynamic data structure provides a means for storing data more efficiently into memory. Using dynamic memory allocation, your program will access memory spaces as needed. This is in contrast to static data structure, wherein the programmer has to indicate a fix number of memory space to be used in the program.

85. What are the different data types in C?

The basic data types are int, char, and float. Int is used to declare variables that will be storing integer values. Float is used to store real numbers. Char can store individual character values.

Best th8 base design 2019

86. What is the general form of a C program?

A C program begins with the preprocessor directives, in Explain Which the programmer would specify Explain Which header file and Explain What constants (if any) to be used. This is followed by the main function heading. Within the main function lies the variable declaration and program statement.

87. What is the advantage of a random access file?

C Language Interview Questions And Answers For Freshers Pdf Answers

If the amount of data stored in a file is fairly large, the use of random access will allow you to search through it quicker. If it had been a sequential access file, you would have to go through one record at a time until you reach the target data. A random access file lets you jump directly to the target address where data is located.

88. In a switch statement, Explain What will happen if a break statement is omitted?

If a break statement was not placed at the end of a particular case portion? It will move on to the next case portion, possibly causing incorrect output.

89. How arrays can be passed to a user defined function

One thing to note is that you cannot pass the entire array to a function. Instead, you pass to it a pointer that will point to the array first element in memory. To do this, you indicate the name of the array without the brackets.

90. What are pointers?

Pointers point to specific areas in the memory. Pointers contain the address of a variable, Explain Which in turn may contain a value or even an address to another memory.

91. Can you pass an entire structure to functions?

Yes, it is possible to pass an entire structure to a function in a call by method style. Explain However, some programmers prefer declaring the structure globally, then pass a variable of that structure type to a function. This method helps maintain consistency and uniformity in terms of argument type.

92. What is gets() function?

The gets() function allows a full line data entry from the user. When the user presses the enter key to end the input, the entire line of characters is stored to a string variable. Note that the enter key is not included in the variable, but instead a null terminator is placed after the last character.

93. The % symbol has a special use in a printf statement. Explain How would you place this character as part of the output on the screen?

You can do this by using %% in the printf statement. For example, you can write printf(“10%%”) to have the output appear as 10% on the screen.

94. Explain How do you search data in a data file using random access method?

Use the fseek() function to perform random access input/ouput on a file. After the file was opened by the fopen() function, the fseek would require three parameters to work: a file pointer to the file, the number of bytes to search, and the point of origin in the file.

95. Are comments included during the compilation stage and placed in the EXE file as well?

No, comments that were encountered by the compiler are disregarded. Comments are mostly for the guidance of the programmer only and do not have any other significant use in the program functionality.

96. Is there a built-in function in C that can be used for sorting data?

Yes, use the qsort() function. It is also possible to create user defined functions for sorting, such as those based on the balloon sort and bubble sort algorithm.

97. What are the advantages and disadvantages of a heap?

Storing data on the heap is slower than it would take when using the stack. Explain However, the main advantage of using the heap is its flexibility. That’s because memory in this structure can be allocated and remove in any particular order. Slowness in the heap can be compensated if an algorithm was well designed and implemented.

98. How do you convert strings to numbers in C?

You can write you own functions to do string to number conversions, or instead use C’s built in functions. You can use atof to convert to a floating point value, atoi to convert to an integer value, and atol to convert to a long integer value.

99. Create a simple code fragment that will swap the values of two variables num1 and num2.

int temp;

temp = num1;

C Language Interview Questions And Answers For Freshers Pdf Free Download

num1 = num2;

C Language Interview Questions And Answers For Freshers Pdf Question

num2 = temp;

int temp;

temp = num1;

num1 = num2;

num2 = temp;

C PROGRAMMING Interview Questions and Answers pdf free download ::