Tutorials  Articles  Notifications  Login  Signup

Introduction C Programming variables (Set 1) C Programming variables (Set 2) C Programming variable and function declaration (set 3) Pointers in C Pointers (set 2)



C Programming variables (Set 1)



MCQ problems on C Programming variables declarations and initializations.


1.

Which of the declaration is correct?

A.
int length;

 

B.
char int;

 

C.
int long;

 

D.
float double;

 



2.

Which of the following operations are INCORRECT?

A.
int i = 35; i = i%5;

 

B.
short int j = 255; j = j;

 

C.
long int k = 365L; k = k;

 

D.
float a = 3.14; a = a%3;

 



3.

Which of the following correctly represents a long double constant?

A.

6.68LF

B.

6.68f

C.

6.68L

D.

6.68



4.

Which of the structure is incorrect?

 

1 :    

struct aa
{
    int a;
    float b;
};


2 :    

struct aa
{
    int a;
    float b;
    struct aa var;
};


3 :    

struct aa
{
    int a;
    float b;
    struct aa *var;
};

 

A.

1

B.

2

C.

3

D.

1,2,3



5.

Which of the structure is correct?

1 :    

struct book
{
    char name[10];
    float price;
    int pages;
};


2 :    

struct aa
{
    char name[10];
    float price;
    int pages;
}


3 :    
 

struct aa
{
    char name[10];
    float price;
    int pages;
}

 

A.

1

B.

2

C.

3

D.

1,2,3



6.

Take a look at following declarations:

1 :    typedef long a;
extern int a c;
2 :    typedef long a;
extern a int c;
3 :    typedef long a;
extern a c;

 

Which of the above declarations is correct ?

A.

1

B.

2

C.

3

D.

1,2,3





HackerFriend Logo

Join the community of 1 Lakh+ Developers

Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.


Create a free account