EMC Corporation C Programming Questions and Answers


Posted on :10-02-2016
EMC Corporation C Programming Questions and Answers:-

Q1.  What do the following declaration denote?
 
char *str[5];

a) str is an array of 5 element pointer to type char
b) str is a pointer to an array of 5 elements
c) str is a function pointer of 5 elements returning char
d) None of the mentioned

ANS: a


Q2. What do the following declaration denote?

 int **ptr;

a) ptr is a function pointer that returns pointer to int type
b) ptr is a pointer to an int pointer
c) ptr is a pointer to pointer to type int
d) None of the mentioned

ANS: b


Q3. Read the following expression?

 void (*ptr)(int);

a) ptr is pointer to int that converts its type to void
b) ptr is pointer to function passing int returning void
c) ptr is pointer to void that converts its type to int
d) ptr is pointer to function passing void returning int

ANS: b


Q4. Comment on the following declaration?

    int (*ptr)(); // i)
    char *ptr[]; // ii)

a) Both i) and ii) and cannot exist due to same name
b) i) is legal, ii) is illegal
c) i) is illegal, ii) is legal
d) Both i) and ii) will work legal and flawlessly

ANS: d


Q5. Which of the following expression is true for the following?
ptr is array with 3 elements of pointer to function returning pointer of int

a) int **ptr[3]();
b) int *(*ptr[3])();
c) int (*(*ptr[3])());
d) None of the mentioned

ANS: b


Q6. What is the output of this C code?

#include
struct student
{
int no = 5;
char name[20];
};
void main()
{
struct student s;
s.no = 8;
printf(hello);
}

a) Nothing
b) Compile time error
c) hello
d) Varies

ANS: b


Q7. Is the below declaration legal?

     int* ((*x)())[2];

a) true
b) false
c) Undefined behaviour
d) Depends on the standard

ANS: b


Q8. What is the output of this C code?

#include
struct student
{
int no;
char name[20];
}
void main()
{
struct student s;
s.no = 8;
printf(hello);
}

a) Compile time error
b) Nothing
c) hello
d) Varies

ANS: a


Q9. What is the output of this C code?

#include
void main()
{
struct student
{
int no;
char name[20];
};
struct student s;
s.no = 8;
printf(%d, s.no);
}

a) Nothing
b) Compile time error
c) Junk
d) 8

ANS: d


Q10. What is the output of this C code?

#include
struct student
{
int no;
char name[20];
};
void main()
{
student s;
s.no = 8;
printf(hello);
}

a) Nothing
b) hello
c) Compile time error
d) Varies

ANS: c




EMC Corporation Related Companies


Placement Papers for All Companies





FreshersLive - No.1 Job site in India. Here you can find latest 2023 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail...
DMCA.com Protection Status