1) What is the basic difference between ++i and i++?

++i basically increments the value of i first and the resulting value be the one to be used. This is also called as prefix increment. Whereas in the case of i++, current value of i will be used in current operation then the value will be incremented. Also called as postfix increment. For more details, you can refer to Increment & Decrement Operators.

2) What is the basic difference between abs() and fabs()?

abs() function in C returns the absolute value of an integer. The absolute value of a number is always positive. Only integer values are supported in C. “stdlib.h” header file supports abs( ) function in C language. Whereas, fabs() function denotes the absolute value for floating point numbers. supports fabs() function in C language.

3) What are the features of C Language?

  • C is the mother of all programming languages like c++, java etc.
  • Programs written in C are efficient and fast. This is due to its variety of data type and powerful operators.
  • C supports structured design approach
  • It is a general-purpose programming language and it is also called as the system programming language. Has a wide variety of data types.

4) What is Header file in C Language?

Header files include definitions and declarations of various library functions which provide programmers extensibility to use those library functions easily in their programs. For example, stdio.h, conio.h, math.h are most commonly used header files in C language.

5) Does C support System programming?

C programming is also well known for system programming which basically helps in the compilation and execution of a program much faster than high-level languages.

6) What is the difference between Keywords and Datatypes in C Language?

Consider a Tree which has leaves, branches. When you say Tree, your mind searches for the word in your brain and then to other stuff like leaves and branches. The data type is a classification of the type of data that a variable or object can hold in programming. A datatype can be an int, float, double. The keyword is a word that cannot be given any use by the programmer than what it was intended. Keywords are the parent of everything. It includes for, if, int, float etc.

7) What do you mean by Functions in C Language?

Functions in C programming are defined as simply a set of statements which are executed one by one. Every program in C contains various functions which perform a particular task defined. We explained the function in depth in this article.

8) What are the different types of Constants in C Language?

  • Integer constants.
  • Real or Floating point constants.
  • Octal & Hexadecimal constants.
  • Character constants.
  • String constants.
  • Backslash character constants.

9) What are the different types of Instructions in C Language?

  • Type Declaration Instruction.
  • Arithmetic Instruction.
  • Control Instruction

In simple terms, Instruction is the language which compiler understands. Type Declaration Instruction is basically used to declare data type variables. Arithmetic Instruction includes Arithmetic operations like a+b and Control Instructions includes control structures, loops.

10) What is Recursion?

When a function calls itself, it is referred to Recursion.

11) What are reserved words in C Language?

Reserved words are the words included in the standard library which have special meaning. For example, int, for, void etc.

12) What are the different types of Errors in C Language?

  • Runtime error
  • Compile Time error
  • Logical Errors

C runtime errors are those errors that occur during the execution of a c program and generally occur due to some illegal operation performed in the program. Compile errors are those errors that occur at the time of compilation of the program and Logical errors are the errors in the output of the program which may be caused due to an error in logic.

13) What is the use of typedef?

typedef is used to give another name to an existing data type.

14) Is C programming language is case sensitive?

Yes, C language is case sensitive language which basically means abc and "ABC" are two different words.

15) What is the difference between Binary files and Text Files?

Text Files are the files which include letters, numbers and other characters. Whereas, Binary files contains 0's and 1's which computers can interpret.

16) What is the basic difference between string character constant and string constant?

String Character Constant is enclosed with single quotes '' and only be represented as a single entity whereas, string constant is an array of characters with a null character at the end of the string. It is represented by double quotes "example".

17) What is the use of getchar() function in C language?

getchar() function returns a character entered through standard input like keyboard and being assigned to a character variable.

18) What is Dangling Pointer in C?

Dangling Pointer in C means pointer is pointing to a non-existing memory location.

#include<stdlib.h>
{
    char *ptr = malloc(Constant_Value);
    .......
    .......
    .......
    free (ptr);  /* ptr now becomes a dangling pointer */
}

To ensure pointer is not a dangling pointer, you have to set that pointer variable as NULL

#include<stdlib.h>
{
    char *ptr = malloc(Constant_Value);
    .......
    .......
    .......
    free (ptr);  /* ptr now becomes a dangling pointer */
    ptr = NULL   /* ptr is no more dangling pointer */
}

19) Does switch statement accepts float values?

// float is not allowed in switch 
#include <stdio.h>
int main() 
{ 
   float x = 3.1; 
   switch (x) 
   { 
       case 1.1: printf("Choice is 1"); 
                 break; 
       default: printf("Choice is 1.2"); 
                break;   
   } 
   return 0; 
}  

Compiler will show an error. The value of the 'expression' in a switch-case statement must be an integer, char, short, long.

20) Does statement y = y + 1 before case statement will be executed ?

#include <stdio.h>
int main() 
{ 
   int y = 1; 
   switch (y) 
   { 
       y = y + 1;  // This statement is not executed 
       case 1: printf("Choice is 1"); 
               break; 
       case 2: printf("Choice is 2"); 
                break; 
       default: printf("Choice is default one"); 
                break;                    
   } 
   return 0; 
}  

Output: Choice is 1. Statements before case statements are never executed.

21) How do you print % symbol using printf() statement in C language?

To print % symbol using printf statement, %% is used.

printf("10%% discount");





codzify.com


Largest collection of up-to-date tutorials to learn programming languages. We are focused on easy learning. Massive collection of interview questions one may need for preparation.

Social Profile


Linkedin
Twitter
Facebook

Copyright 2020. All rights reserved.