0% found this document useful (0 votes)
11 views

C Declaration and Initialization

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

C Declaration and Initialization

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1) What will be the output of following program ?

Copy
int main(){
int m=10;
int x=printf("%d ",m);
printf("%d",x);
return 0;
}

1. 10 3
2. 103
3. 10 2
4. 102

Answer & Explanation

2) What will be the output of following program ?

Copy
int main(){
int x='A';
printf("%02X",x);
return 0;
}

1. 65
2. 97
3. Error
4. 41

Answer & Explanation

3) What will be the output of following program ?

Copy
int main(){
char a=0b1010;
printf("%02X",a);
return 0;
}

/
1. 0A
2. A
3. 0a
4. 10

Answer & Explanation

4) What will be the output of following program (on 32 bit compiler)?

Copy
int main(){
char a=2*2+2;
printf("%d",a);
return 0;
}

1. 0
2. Garbage
3. 6
4. 8

Answer & Explanation

5) What will be the output of following program ?

Copy
int main(){
unsigned char x=-1;
printf("%02X",x);
return 0;
}

1. 0xFFFFFFFF
2. FF
3. 0xFF
4. ff

Answer & Explanation

6) Which is the correct name of a variable? /


(A) -var (B) var-1 (C) _var (D) var_1

1. Only (A)
2. Only (B)
3. Both (A) and (B)
4. Both (C) and (D)

Answer & Explanation

7) Which special character can be used to separate two parts (words) of a variable/identifier
name?

1. - (Hyphen)
2. _ (Underscore)
3. $ (Dollar)
4. # (Hash)

Answer & Explanation

8) What will be the result of following program?

Copy
#include <stdio.h>
int main()
{
char x='AB';
printf("%c",x);
return 0;
}

1. Error
2. Runs successfully and prints 'A' (without quote)
3. Run with warnings and prints 'B' (without quote)
4. None of these

Answer & Explanation

9) Will following string be terminated with NULL?


/
char str[]={'H','e','l','l','o'};

1. YES
2. NO

Answer & Explanation

10) Predict the output of following program.

Copy
#include <stdio.h>

int main()
{
int (x)=10;
printf("x= %d",x);

return 0;
}

1. x= 10
2. x= 0
3. Error
4. None of these

Answer & Explanation

11) Predict the output of following program.

Copy
#include <stdio.h>

int main()
{
int i=50;
const int x=i++;
printf("x= %d",++x);

return 0;
}

1. x= 50
2. x= 51
3. x= 52 /
4. Error

Answer & Explanation

12) Predict the output of following program.

Copy
#include <stdio.h>

int main()
{
int a=(10,20);
printf("a= %d",a);

return 0;
}

1. a= 10
2. a= 20
3. a= 30
4. Error

Answer & Explanation

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy