C Interview Question-Part1

Posted on:
tags: , , , ,

1) What is static variable?
     Static variable are constant variable whose value remain the same throughout the program. Static variable are instant variable

2) How can you determine the size of an allocated portion of the memory?
     The malloc or free implementation would determine the size of the memory easily.

3) Why do we use structure?
     Structures are used for various purpose
         * Use of structure variable
         * To develop individual array.

4) Define these functions fopen(), fread(), fwrite() and fseek()?
    Fopen():- function to open a file, the pointer points to the first record in the file.
    Fread():- it reads the file were the pointer is pointing.
    Fseek():- This function enables to move from one record to another.
    Fwrite:- This function write data in the file were the pointer is pointing.

5) What are logical operators in C?

     Logical operators in C are AND and OR operator.
     AND denoted by && for example exp1&& exp2
     OR denoted by || for example exp1||exp2

6) What is enum used for and state its format?
     Enum creates a sequence of integer constant. It is optional to use the name in the enum. The names are separated by comma and within the curly braces.

7) what is ternary operator?
     This operator return the value based on the evaluation of the expression.
     General format:-
     (expr 1) ? true: false  
     It is similar to if else construct.

8) Can u write c program without using main function?
     Without the main function the program will not be executed. The compiler starts compiling from the main function.

9) What is the use of main function?
     The main function invokes other function within it. It is first function during the execution of the program.

10) Is c a structural language?
      No C is a procedural language. An example of structural language is COBOL.

11) What are the rules for constructing the real constant?
    * A real constant should have atleast one digit
    * It should be a decimal point
    * By default it is assigned positive value
    * Within real constant no blank space or commas. 

12) The following variable is available in xyz.c, who can access it?:
        Static float score
        All the functions that contained in the file can access the variable.

13) Disadvantage of using pointers?
       The major disadvantage of using pointers is that hackers easily identify source code address and can modify the source code. It is possible to access even the restricted memory space.

14) Why do we use void main() in C language?
       The program starts its execution from void main function.   Every function in the program return some value after the execution of the function.

15) How can I convert number into string?

       Number can be converted into string by using the itoa() function. Sprintf can also be used to convert number into string. 

16) What are the advantages of the functions?
      ·Testing is much easier
      ·More readability
      ·Improves the performance of the program
      ·Reduce the program size.
      ·Understanding the logic quiet easy.

17) Difference between internal and external static?
     Static variable declared internally within the static class and have scope within the class is internal static variable. External static variable declared outside the function and have scope throughout the program.

18) Are pointers integers?
     Pointers represents the address and it is merely holds a positive value.

19) Can a file other then abc.h be included with #include?
     Whatever file specified in the # include the preprocessor would include it. It is always advisable that the programs should be saved with .c extension.

20) what is static identifier?
     Static variable represents local variable and it remains in the memory even after the execution of the function.

21) what is static identifier?
     Static variable represents local variable and it remains in the memory even after the execution of the function.

22) What are the advantages of the automated variable?
     Auto variable can be used in different blocks.
        Efficient use of memory.
        Variables are protected.        

23) What is the use of clrscr()?
      Clscr() is a function creates a black screen that creates an impression of clearing the screen.

24) What is the difference between far and near?
      Near pointer operates under 64 kilo bytes and far pointer operates under 16 kilo bytes. Far pointer are little slower when compared to near pointers.

25) What is size of operator?
      Size of operator is to obtain the size of the operand. Format of size of operator Sizeof ( expr).

Posted By Sundeep aka SunTechie

Sundeep is a Founder of Youth Talent Auzzar, a passionate blogger, a programmer, a developer, CISE and these days he is pursuing his graduation in Engineering with Computer Science dept.
Add Sundeep as a Friend on 

No comments:

Post a Comment

< >