main()
{
int sub[50];
for(i=0; i<=48;i++)
{
sub[i]=i;
printf("
%d", sub[i]);
}
}
0 to 48 will be displayed
48
49
Compilation Error
D. Compilation Error
True
False
Work same as printf()
prints the error message specified by the compiler
prints the garbage value assigned by the compiler
None of the above
True
False
int num[6] = { 2, 4, 12, 5, 45, 5 } ;
int n{} = { 2, 4, 12, 5, 45, 5 } ;
int n{6} = { 2< 4< 12 } ;
int n(6) = { 2, 4, 12, 5, 45, 5 } ;
True
False
True
False
std::bad_creat
std::bad_alloc
std::bad_cast
std::bad_typeid
.
?
;
none of the above
True
False
3
4
5
infinite
True
False
True
False
True
False
Only once
At least once
More than Once
Any one of the above
True
False
void main()
{
static int a = 1, b, c;
if (a>=2) b=2; c=3;
printf("%d\t%d", b,c);
}
2 3
0 3
0 0
2 0
True
False
True
False
A
B
BCPL
C++
void main()
{
int a = 0;
while (a<=50) for(;;) if(++a % 50==0) break;
printf("a = %d", a);
}
a = 100
a = 50
compilation error
runtime error
True
False
True
False
#define sqr(x= x*x)
main()
{
int a = 10, b = 5;
printf("%d, %d", sqr(a+b),sqr(++a));
}
77, 121
225, 121
77< 144
Compilation error
What will be output if you will compile and execute the following c code?
#include
int main(){
char c=125;
c=c+10;
printf("%d",c);
return 0;
}
135
+INF
-121
-135
the increment should always be ++k
the variable must always be the letter i when using a for loop
there should be a semicolon at the end of the statement
the commas should be semicolons
the question mark should be an equal sign
the first semicolon should be a colon
there are too many variables in the statement
the conditional operator is only used with apstrings
float
string
int
wchar_t
while (1)
{i++;}
for( ; ; );
while (true)
{false = 1;}
do
{y = x;}
while (x==0);
float a =123.56;
char ch ='T' * 'A';
char ch ='T' *20;
3 +a = b;
Dennis Ritchie
Ken Thompson
Bill Gates
Peter Norton