Friday, 2 February 2018

C MCQ - Random chapters

1. The function ____ obtains block of memory dynamically.
a) calloc
b) malloc
c) Both calloc & malloc 
d) free

2. For a typical program, the input is taken using
a) scanf
b) Files
c) Command-line
d) All of the mentioned

3. What is the default return-type of getchar()?
a) char
b) int 
C. char *
D. reading character doesn’t require a return-type

4. Memory allocation using malloc() is done in?
a) Static area
b) Stack area
c) Heap area
d) Both Stack & Heap area

5. What is the sizeof(char) in a 32-bit C compiler?
a) 1 bit
b) 2 bits
c) 1 Byte
d) 2 Bytes


C - MCQ - SimpleWay2Code


6. What type of value does sizeof return?
a) char
b) short
c) unsigned int
d) long

7. Which one is used during memory deallocation in C?
a) remove(p);
b) delete(p);
c) free(p);
d) terminate(p);

8. What is the output of this C code?

    #include <stdio.h>
    void main()
    {
        int x = 97;
        int y = sizeof(x++);
        printf("x is %d", x);
    }
a) x is 97 
b) x is 98
c) x is 99
d) Run time error

2 comments:

  1. all these qtns appeared in TCS 2017 exam mcqs?

    ReplyDelete
    Replies
    1. No, these are sample papers (Chapterwise). for recently asked MCQ , go to TCS Placement papers, where you can check TCS MCQ Questions in the bottom of the page. or directly go here: http://www.simpleway2code.me/p/tcs-interview-experience.html?m=1

      Delete

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...