Results 1 to 4 of 4

Thread: Basic Important Interview Questions in C

  1. #1
    Moderator goldsonam's Avatar
    Join Date
    Feb 2011
    Location
    India
    Posts
    183
    Blog Entries
    20
    Rep Power
    4

    Basic Important Interview Questions in C

    If you are willing to test your command over C,go through the 10 questions below and answer them before going through the solution! Self access and you will know your chances!
    Code:
    1. Is C a High Level Language or a Low Level Language?
    
    
    Well, its neither!!! Actually C is a mixture of both… How??? C supports High Level Language features like easy syntax, branching, looping, arrays, structures and also has pointers, memory allocation methods which are Low Level Language features. So, C is a High Level Language with Low Level features or a Mid Level Language.
    2.What are Type Modifiers?
    Type modifiers are some keywords used along with variable declaration to change the inherent nature of the variables i.e. the modifiers are used to vary the sizes of the variables. Keywords used as type modifiers are: [UL] short[/UL] [UL] long [/UL] [UL] signed [/UL] [UL] unsigned[/UL]
    3.What does Storage Class of a variable suggest? What are the types of Storage Class?
    It suggests: [UL] where the variable will be stored [/UL] [UL] what will be the initial value of the variable, if the default initial value is not specified [/UL] [UL] what is the scope of the variable i.e. in which functions the value of the variable would be available. [/UL] [UL] what is the life of the variable, i.e. how long the variable would exist. [/UL] There are four storage classes in C: [UL] Automatic storage class[/UL] [UL] Register storage class [/UL] [UL]Static storage class[/UL] [UL] External storage class [/UL]
    4.Find the output for the following C program main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf ("%d %d \n", x, y); }
    Ans. 57 94
    5. main() { extern int i; i=20; printf ("%d", i); }
    Answer: Linker Error : Undefined symbol ‘i’ Extern storage class in the following declaration, extern int i; specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with memory space allocated for it. Hence a linker error has occurred .
    6. What will be output of following code? void main() { char a[5]; a[0]='q'; a[1]='u'; a[2]='e'; clrscr(); printf ("%s", a); getch(); }
    Answer: Output: garbage Explanation: %s is used for string but a is not a string it is only array of character since its last character is not null character. If you will write a[3]=’\0’; then output will be que.
    7. What is the output of the following code:- void main() { int i; for(i=0;i<3;i++) { int i=100; i--; printf ("%d.. ",i); } } (a)0..1..2.. (b)99..98..97.. (c)100..100..100.. (d)99..99..99..
    Answer: d
    8. How to type a string without using printf function?
    #include int main() { char *str="shobhit"; while((*str)!=NULL) { putchar(*str); str++; } return 0; }
    OR
    #include void main() { char str[10]="lincoln"; puts(str); }
    9. How do I access command-line arguments?
    int main(int argc, char * argv[]) { } argc is the number of arguments stated in the command line. Use argv[0] to get the program (process) name Use argv[1],…, to argv[argc-1] to get the command lines.
    10.How to swap the content of two variables without a temporary variable?
    void swap (int a, int b) { a=a+b; b=a-b; a=a-b; }
    OR
    void swap (int a, int b) { a =a*b; b=a/b; a=a/b; }
    techforum4u.com Member!!

  2. #2
    Member prafic's Avatar
    Join Date
    Feb 2011
    Location
    kolkata,india
    Posts
    84
    Blog Entries
    17
    Rep Power
    0

    Re: Basic Important Interview Questions in C

    nice and well formatted post goldsonam, keep it up.............................
    techforum4u.com Member!!

  3. #3
    Moderator goldsonam's Avatar
    Join Date
    Feb 2011
    Location
    India
    Posts
    183
    Blog Entries
    20
    Rep Power
    4

    Re: Basic Important Interview Questions in C

    Thanks prafic....
    techforum4u.com Member!!

  4. #4
    Junior Member anishrushi's Avatar
    Join Date
    Dec 2013
    Location
    bangalore
    Posts
    5
    Rep Power
    0

    Re: Basic Important Interview Questions in C

    Have a look on @ skillgun.com for more c interview questions
    techforum4u.com Member!!

Similar Threads

  1. Some Important HR questions
    By sonuaks in forum HR Questions And Discussions
    Replies: 2
    Last Post: 11-17-2014, 08:59 AM
  2. Some Important Expected HR Questions In Interview
    By angad in forum Jobs And Recruitment
    Replies: 23
    Last Post: 01-23-2012, 05:30 AM
  3. Data Structure Important Interview Questions
    By pakkiaraj kasinathan in forum Technical Questions Papers and Discussions
    Replies: 0
    Last Post: 12-07-2011, 07:34 AM
  4. Java Important Interview Questions
    By nikita sharma in forum Technical Questions Papers and Discussions
    Replies: 0
    Last Post: 12-07-2011, 07:29 AM
  5. Replies: 4
    Last Post: 07-21-2011, 06:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.