Professional Documents
Culture Documents
MCQ C
MCQ C
a) typedefs
b) Function pointer
View Answer
Answer: b
View Answer
Answer: d
#include <stdio.h>
return a * b * c;
void main()
function_pointer = mul;
function_pointer(2, 3, 4));
}
c) Nothing
d) Varies
View Answer
Answer: a
#include <stdio.h>
int myfoo(int);
int (*fooptr)(int);
int ((*foo(int)))(int);
int main()
fooptr = foo(0);
fooptr(10);
return myfoo;
int myfoo(int i)
printf("%d\n", i + 1);
a) 10
b) 11
c) Compile time error
d) Undefined behaviour
View Answer
Answer: b
View Answer
Answer: b
c) int main()
View Answer
Answer: a
View Answer
Answer: a
#include <stdio.h>
void foo();
int main()
void foo();
foo();
return 0;
void foo()
printf("2 ");
b) 2
View Answer
Answer: b
2. What is the output of this C code (without linking the source file in which ary1 is defined)?
#include <stdio.h>
int main()
extern ary1[];
printf("scope rules\n");
a) scope rules
View Answer
Answer: a
b) From the point of declaration to the end of the file in which it is defined
d) From the point of declaration to the end of the file being compiled
View Answer
Answer: d
a) string
b) structures
c) char
View Answer
Answer: b
Explanation: None.
2. User-defined data type can be derived by___________
a) struct
b) enum
c) typedef
View Answer
Answer: d
Explanation: None.
a) –
b) <-
c) .
View Answer
Answer: c
Explanation: None.
a) Another structure
b) Function
c) Array
View Answer
Answer: b
Explanation: None.
a) struct temp{}s;
main(){}
b) struct temp{};
struct temp s;
main(){}
c) struct temp s;
struct temp{};
main(){}
View Answer
Answer: d
Explanation: None.
#include <stdio.h>
struct student
int no;
char name[20];
void main()
struct student s;
s.no = 8;
printf("hello");
b) Nothing
c) hello
d) Varies
View Answer
Answer: a
Explanation: None.
#include <stdio.h>
struct student
int no = 5;
char name[20];
};
void main()
struct student s;
s.no = 8;
printf("hello");
a) Nothing
c) hello
d) Varies
View Answer
Answer: b
Explanation: None.
#include <stdio.h>
struct student
int no;
char name[20];
};
void main()
student s;
s.no = 8;
printf("hello");
a) Nothing
b) hello
d) Varies
View Answer
Answer: c
Explanation: None.
#include <stdio.h>
void main()
struct student
int no;
char name[20];
};
struct student s;
s.no = 8;
printf("%d", s.no);
a) Nothing
c) Junk
d) 8
View Answer
Answer: d
Explanation: None.
#include <stdio.h>
struct p
int k;
char c;
float f;
};
int main()
printf("%f\n", x.f);
a) Yes
b) No
View Answer
Answer: c
Explanation: None.