C Programming: Declarations and Initializations » Point Out Errors

0
701
C Programming: Declarations and Initializations » Point Out Errors
C Programming: Declarations and Initializations » Point Out Errors

C Programming: Declarations and Initializations » Point Out Errors

  • Declarations and Initializations – General Questions
  • Declarations and Initializations – Find Output of Program
  • Declarations and Initializations – Point Out Errors
  • Declarations and Initializations – Point Out Correct Statements
  • Declarations and Initializations – True / False Questions
  • Declarations and Initializations – Yes / No Questions

1. Point out the error in the following program (if it is compiled with Turbo C compiler).

#include<stdio.h>
int main()
{
    display();
    return 0;
}
void display()
{
    printf("IndiaBIX.com");
}

A. No error
B. display() doesn’t get invoked
C. display() is called before it is defined
D. None of these

Answer: Option C

 

2. Point out the error in the following program.

#include<stdio.h>
int main()
{
    void v = 0;

    printf("%d", v);

    return 0;
}

A. Error: Declaration syntax error ‘v’ (or) Size of v is unknown or zero.
B. The program terminates abnormally.
C. No error.
D. None of these.

Answer: Option A

 

3. Point out the error in the following program.

#include<stdio.h>
struct emp
{
    char name[20];
    int age;
};
int main()
{
    emp int xx;
    int a;
    printf("%d\n", &a);
    return 0;
}

A. Error: in printf
B. Error: in emp int xx;
C. No error.
D. None of these.

Answer: Option B

 

4. Which of the following is correct about err used in the declaration given below?

 typedef enum error { warning, test, exception } err;

A. It is a typedef for enum error.
B. It is a variable of type enum error.
C. The statement is erroneous.
D. It is a structure.

Answer: Option A

 

5. Point out the error in the following program.

#include<stdio.h>
int main()
{
    int (*p)() = fun;
    (*p)();
    return 0;
}
int fun()
{
    printf("IndiaBix.com\n");
    return 0;
}

A. Error: in int(*p)() = fun;
B. Error: fun() prototype not defined
C. No error
D. None of these

Answer: Option B

 

TAGS: C Programming: Declarations and Initializations » Find Output of Program, C Programming, Declarations, and Initializations, Find Output of Program, c programming basics, c programming language, c programming patterns, c programming tutorial, c programming example, c programming pdf, for c programming example, c programming questions, c programming questions, and answer

 

www.GKDuniya.in will update many more new jobs and study materials and exam updates, keep Visiting and share our post of Gkduniya.in, So more people will get this. This content and notes are not related to www.GKDuniya.in and if you have any objection over this post, content, links, and notes, you can mail us at gkduniyacomplaintbox@gmail.com

And you can follow and subscribe to other social platforms. All social site links in the subscribe tab and bottom of the page.

Important Links

Youtube:- GKDuniya9
Instagram:- GKDuniya.in
Facebook:– GKDuniya.in