C Programming Basic Input - Output
C Programming Basic Input - Output
Copy
#include <stdio.h>
void main()
{
printf("includehelp.com\rOK\n");
printf("includehelp.com\b\b\bOk\n");
}
1. OK
includehelp.ok
2. OK
includehelp.okm
3. includehelp.com
includehelp.okm
4. OKcludehelp.com
includehelp.okm
Copy
#include <stdio.h>
void main(){
unsigned char c=290;
printf("%d",c);
}
1. 34
2. 290
3. Garbage
4. ERROR
Copy
#include <stdio.h>
void main(){
int a=0;
a=5||2|1;
/
printf("%d",a);
}
1. 1
2. 7
3. 0
4. 8
Copy
#include <stdio.h>
int main(){
float a=125.50;
int b=125.50;
char c='A';
printf("%d,%d,%d\n",sizeof(a),sizeof(b),sizeof(125.50));
printf("%d,%d\n",sizeof(c),sizeof(65));
return 0;
}
1. 4,4,4
1,4
2. 4,4,8
1,1
3. 4,4,4
1,1
4. 4,4,8
1,4
Copy
#include <stdio.h>
int main(){
static char a;
static long b;
int c;
printf("%d,%d,%d",a,b,c); /
return 0;
}
1. 0,0,0
2. Garbage,Garbage,Garbage
3. Garbage,Garbage,0
4. 0,0,Gargabe
Copy
#include <stdio.h>
int main()
{
int ok=-100;
-100;
printf("%d",ok);
return 0;
}
1. 100
2. ERROR
3. -100
4. 0
Copy
#include <stdio.h>
enum numbers
{
zero, one, two, three , four=3,five,six,seven=0,eight
};
void main()
{
printf("%d,%d,%d,%d,%d,%d,%d,%d,%d",zero,one,two,three,four,five,six,seven
}
1. 0,1,2,3,3,4,5,0,1
/
2. 0,1,2,4,5,6,7,8,9
3. 0,1,2,3,3,1,2,3,4
4. 0,1,2,3,3,4,5,0,9
Copy
#include <stdio.h>
int main(){
int a,b,c;
a=0x10; b=010;
c=a+b;
printf("\nAddition is= %d",c);
return 0;
}
1. Addition is = 20
2. Addition is = 24
3. Addition is = Garbage
4. ERROR
Copy
#include <stdio.h>
int main()
{
int var=250;
printf("value of var = %d\n",var);
200+50;
"includehelp.com";
printf("%s\n","includehelp");
return 0;
}
Copy
#include <stdio.h>
int main()
{
int a=100;
printf("%d\n"+1,a);
printf("Value is = %d"+3,a);
return 0;
}
1. ERROR
2. 101,
Value is = 103
3. d
ue is = 100
4. 100
100
Copy
#include <stdio.h>
int main()
{
extern int ok;
printf("value of ok = %d",ok);
return 0;
}
extern int ok=1000;
1. Declaration error
2. value of ok = 1000.
3. Linking error
4. value of ok = 0.
/
12) What will be the output of following program ?
Copy
#include <stdio.h>
int main()
{
int a=23;
;
;printf("%d",a);
;
return 0;
}
1. 23
2. Error
3. ;23;
4. ;23
Copy
#include <stdio.h>
int main()
{
int intVar=24;
static int x=intVar;
printf("%d,%d",intVar,x);
return 0;
}
1. 24,24
2. 24,0
3. ERROR: Illegal Initialization
4. Run time error.
Copy
#include <stdio.h>
int main()
{ /
int a=15;
float b=1.234;
printf("%*f",a,b);
return 0;
}
1. 1.234
2. 1.234000
3. 1.234000
4. ERROR
Copy
#include <stdio.h>
int main()
{
float a,b;
a=3.0f;
b=4.0f;
printf("%.0f,%.1f,%.2f",a/b,a/b,a/b);
return 0;
}
1. 1,0.8,0.75
2. 0,0.7,0.75
3. 0,0.8,0.75
4. ERROR: Invalid format specifier
16) Which is the valid identifier (variable name) to store student’s age?
1. int student-age;
2. int student_age;
3. int -age;
4. int _age;
1. goto xyz
2. int x=20
3. #define MAX 1000
4. do{ ... }while(count<=100)