Usually asked about Programming || Interview Questions, Since we have already spoken about the java and the importance it has and its features today let us divert our topic to another programming language that we often speak about but we have never really discussed it. The programming language that I was talking about is C. This language was developed in the early 1970s. although it was initially developed for writing system software today it has become such a popular language that a variety of software programs are written using it. The greatest advantage of C is that it can be easily used in different types of computers.
STRUCTURE OF C PROGRAM:
A-C program contains one or a lot of functions, wherever a operate is outlined as a group of statements that perform a well-defined task. The statements during a perform area unit written during a logical sequence to perform a particular task. The main function is the most important function and is a part of every c program. Rather, the execution od the C program begins with this function.
BASIC DATA TYPES:
Data types determine the set of values that a data item can take and the operations that can be performed on the item. While the smaller data types take less memory, the larger types incur a performance penalty. Although the information sort we use for our variables doesn’t have a big impact on the speed or memory usage of the application, forever|we must always} always attempt to use int unless there’s a requirement to use the other information sort.
VARIABLES AND CONSTANTS:
A variable is defined as a significant name given to a knowledge storage location within the computer memory. once using a variable, we tend to truly ask the address of the memory wherever the data is stored. C language supports two basic types of variables. Constants are identifiers whose values don’t modification. while the3 values of variables will be changed at any time, the values of constants will never be modified.
Comments are a way of explaining what a program does. C supports 2 types of comments and they are a comment in a single statement and a comment in multiple statements. We need to note that the compiler does not execute the comment statements as they are simply added in the programs to make the code understandable by programmers as well as other users. It is a good habit to always put a comment at the top of the program that tells us what the program does. This helps us in defining the usage of the program the moment we open it.
OPERATORS AND EXPRESSIONS:
C language supports different types of operators, which can be used with variables and constants to make expressions. These can be categorized into many different groups as well.
TYPE CONVERSION AND TYPECASTING:
Type conversion or sportscasting of variables refers to dynamic a variable of one information type into another. While type conversions are done implicitly, casting has to be done explicitly by the programmer. Type conversion is done when the expression has variables of different data types. So, to evaluate the expression, the data type is promoted from lower to a higher level where the hierarchy of the data types can be maintained properly. Typecasting is also known as forced conversion. It is done once the worth of one information sort needs to be converted into the worth of another information sort.
C enables the programmers to break up the programs into a number of segments commonly known as functions, each of which can be written more or less indecently of the others. Every function in the program is supposed to perform a well-defined task. Therefore the program code of one function is completely insulated from the other functions.
Top 30 Programming interview questions
1) Write code to check a String is a palindrome or not?
2) Write a method that will remove any given character from a String?
Print all permutation of String both iterative and Recursive way?
4) Write a function to find out the longest palindrome in a given string?
5) How to find the first non repeated character of a given String?
6) How to count the occurrence of a given character in a String?
7) how to check if 2 String is Anagram?
8) how to convert numeric String to int in Java?
9) In associate array 1-100 numbers are stored, one variety is missing how do you realize it?
10) In an array 1-100 exactly one range is duplicate how do you notice it?
11) In an array 1-100, multiple numbers ar duplicates, how does one realize it?
12) Given 2 arrays, 1,2,3,4,5 and 2,3,1,0,5 find that number isn’t present in the second array.
13) how does one find the second-highest number in an integer array?
14) how to realize all pairs in an array of integers whose sum is adequate for the given number?
15) How to remove duplicate elements from the array in Java?
16) How to find the largest and smallest number in an array?
17) How to find the top two maximum number in an array?
14) How do you find the middle element of a linked list in a single pass?
15) How do you find the 3rd element from last in a single pass?
16) How do you find if there is any loop in a singly linked list? How do you find the start of the loop?
17) How do you reverse a singly linked list?
18) Difference between a linked list and an array data structure?
19) Write a program to sort numbers in place using quick sort?
20) Write a program to implement a binary search algorithm in Java or C++?
21) How do you sort Java objects using a Comparator?
22) Write code to implement Insertion Sort in Java?
23) Write code to implement Bubble Sort in Java?
24) Write code to check whether a no is a power of two or not?
25) Write a program to check whether a number is a palindrome or not?
26) Write code to check whether an integer is Armstrong number or not?
27) Write a program to find all prime numbers up to a given number?
28) Write a function to compute the Nth Fibonacci number? Both iterative and recursive?
29) How to check if a number is binary?
30) How to reverse an integer in Java?
31) How to count a number of set bits in a given integer?
C programs have all the features of if-else and switch statements that we have learned in the case of java. It shows us the use of pointers and call by reference and call by the address which helps us in calling the function and using the called function accordingly. Starting from the function declaration to using the function to print the required statements all are equally prevalent in C. thus this is all that we need to know in order to start without C language.