A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. What is the output of this C code?
#include <stdio.h>
    int main()
    {
        void foo();
        printf("1 ");
        foo();
    }
    void foo()
    {
        printf("2 ");
    }
a. 1 2
b. Compile time error
c. 1 2 1 2
d. Depends on the compiler
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).1 2

2. What is the output of this C code?
#include <stdio.h>
    int main()
    {
        void foo(), f();
        f();
    }
    void foo()
    {
        printf("2 ");
    }
    void f()
    {
        printf("1 ");
        foo();
    }
a. Compile time error as foo is local to main
b. 1 2
c. 2 1
d. Compile time error due to declaration of functions inside main
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).1 2

3. What is the output of this C code?
#include <stdio.h>
    int main()
    {
        void foo();
        void f()
        {
            foo();
        }
        f();
    }
    void foo()
    {
        printf("2 ");
    }
a. 2 2
b. 2
c. Compile time error
d. Depends on the compiler
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Depends on the compiler

4. What is the output of this C code?
#include <stdio.h>
    void foo();
    int main()
    {
        void foo();
        foo();
        return 0;
    }
    void foo()
    {
        printf("2 ");
    }
a. Compile time error
b. 2
c. Depends on the compiler
d. Depends on the standard
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).2

5. What is the output of this C code?
#include <stdio.h>
    void foo();
    int main()
    {
        void foo(int);
        foo(1);
        return 0;
    }
    void foo(int i)
    {
        printf("2 ");
    }
a. 2
b. Compile time error
c. Depends on the compiler
d. Depends on the standard
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).2

6. What is the output of this C code?
#include <stdio.h>
    void foo();
    int main()
    {
        void foo(int);
        foo();
        return 0;
    }
    void foo()
    {
        printf("2 ");
    }
a. 2
b. Compile time error
c. Depends on the compiler
d. Depends on the standard
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Compile time error

7. What is the output of this C code?

include <stdio.h>
void m()
{
printf("hi");
}
void main()
{
m();
}
a. hi
b. Run time error
c. Nothing
d. Varies
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).hi

8. What is the output of this C code?
#include <stdio.h>
    void m();
    void n()
    {
        m();
    }
    void main()
    {
        void m()
        {
            printf("hi");
        }
    }
a. hi
b. Compile time error
c. Nothing
d. Varies
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Compile time error

9. What is the output of this C code?
#include <stdio.h>
    void main()
    {
        m();
        void m()
        {
            printf("hi");
        }
    }
a. hi
b. Compile time error
c. Nothing
d. Varies
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Compile time error

10. What is the output of this C code?
#include <stdio.h>
    void main()
    {
        m();
    }
    void m()
    {
        printf("hi");
        m();
    }
a. Compile time error
b. hi
c. Infinite hi
d. Nothing
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Infinite hi

Page 1 of 30