Top

Typedef

1.

What will be the output of the program?

#include

int main()
{
    typedef int LONG;
    LONG a=4;
    LONG b=68;
    float c=0;
    c=b;
    b+=a;
    printf("%d,", b);
    printf("%f\n", c);
    retu

 

Answer: A

No answer description available for this question.

Enter details here

2.

What is x in the following program?

#include

int main()
{
    typedef char (*(*arrfptr[3])())[10];
    arrfptr x;
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

3.

Which of the following may create problem in the typedef program?

Answer: D

No answer description available for this question.
 

Enter details here

4.

In the following code, the P2 is Integer Pointer or Integer?

typedef int *ptr;
ptr p1, p2;

 

Answer: B

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.

Enter details here

6.

The size of both stack and heap remains the same during run time.

Answer: B

Memory can be allocated or de-allocated during the run time in the heap region. Memory bindings (allocation and de-allocation) are established and destroyed during the execution of the program. Hence we can see that the size of heap does not remain same during run time. However, the size of stack remains the same.

Enter details here

7.

Which of the given option is the correct method for initialization?

typedef char *string;

 

Answer: B

No answer description available for this question.
 

Enter details here

8.

For the following expression to work, which option should be selected.
string p = “HELLO”;

Answer: B

No answer description available for this question.
 

Enter details here

9.

What will be the output of the following C code? (If the name entered is: Sanfoundry)

#include
#include
typedef struct employee
{
    char  name[50];
    int   salary;
} e1;
void main( )
{
    printf("Enter Employee name");
    scanf("%s",e1.name);
    printf("\n%s",e1.name);
}

 

Answer: D

The code shown above will result in an error because we have used the data type e1 (defined using the keyword typedef) in the form of an identifier.

Enter details here

Answer: D

No answer description available for this question.

Enter details here

Loading…
Tags: Typedef Questions and Answers || Typedef MCQ Questions and Answers || Typedef GK Questions and Answers || Typedef GK MCQ Questions || Typedef Multiple Choice Questions and Answers || Typedef GK || GK on Typedef || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming