C MCQs for placement and exams - Set 7

C MCQs for placement and exams - Set 7


1.) Trace the output of the code

#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf(""%d\n"", *p);
}

a.) 10
b.) Some garbage value
c.) Segmentation fault/Code crash
d.) Compile time error
View Answer / Hide Answer

ANSWER: c.) Segmentation fault/Code crash




2.) #include
struct p
{
int x;
char y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 3);
if (x == sizeof(int) + sizeof(char))
printf(""%d\n"", ptr1->x);
else
printf(""falsen"");
}


a.) Compile time error
b.) 1
c.) Undefined Behaviour
d.) FALSE
View Answer / Hide Answer

ANSWER: d.) FALSE




3.) Which of the following structure declaration doesn't require pass-by-reference?
a.) struct{int a;}s; main(){ }
b.) struct temp{int a;}; main() { struct temp s; }
c.) struct temp{int a;};
main(){}
struct temp s;
d.) None of the mentioned
View Answer / Hide Answer

ANSWER: d.) None of the mentioned




4.) Which of the following is correct statement?
a.) Variable name must start with underscore
b.) Variable name must have digit
c.) keyword can not be a variable name
d.) None of the mentioned
View Answer / Hide Answer

ANSWER: c.) keyword can not be a variable name




5.) In c programming a function can return ___________
a.) Single value
b.) Double value
c.) Many value
d.) all of the above
View Answer / Hide Answer

ANSWER: a.) Single value




6.) Array index always start from
a.) 0
b.) 1
c.) 2
d.) 3
View Answer / Hide Answer

ANSWER: a.) 0




7.) Which of the following is incorrect statement
a.) All array variable have same type
b.) An array is the collection of variable
c.) Array variable can be used individually
d.) None of the mentioned
View Answer / Hide Answer

ANSWER: d.) None of the mentioned




8.) While coding in c programming for "call by reference" we pass
a.) Address of variable
b.) Value of variable
c.) Either value or address
d.) Both value and address
View Answer / Hide Answer

ANSWER: a.) Address of variable




9.) An assembly language is a .......... programming language but BASIC is ....... programming language
a.) problem oriented.....low level
b.) problem oriented.........high level
c.) machine oriented......high level
d.) machine oriented......low level
View Answer / Hide Answer

ANSWER: c.) machine oriented......high level




10.) A utility programme that takes a procedure and searches a library to locate copies of any procedures called but not defined in the first procedure, is called
a.) Linker
b.) Re-locator
c.) Loader
d.) Text editor
View Answer / Hide Answer

ANSWER: a.) Linker


Post your comment