NEW
Font size
WorksheetsPSPC1
Total questions: 20
Worksheet time: 10mins
Which of the following is a valid variable name declaration?
Int x;
int 5x;
int x5;
int $x;
Which of the following is a not valid variable name declaration?
int x;
int 5x;
int x5;
int x_5;
Which of the following is a valid C variable name?
main
5x
x 5
xp2$
What is the output of this C code?
#include <stdio.h>
int main()
{
printf("Hello World! %d \n", x);
return 0;
}
Hello World! x;
Hello World! followed by a junk value
Hello World!
Compile time error
What will happen if the below program is executed?
#include <stdio.h>
int main()
{
int main = 3;
printf("%d", main);
return 0;
}
a compile-time error
a run-time error
print 3
infinite loop
Which among the following is NOT a logical or relational operator?
==
!=
||
=
Which among the following is a logical operator?
==
++
||
-
Which of the following is a correct comment?
/*comment*/
*/comment*/
/*comment/*
{*comment*}
The format identifier %d is used for___ data type.
int
char
float
double
The format identifier ____ is used for double data type.
%lf
%d
%D
%c
The format identifier ____ is used for float data type.
%f
%d
%D
%c
What is 'short int' in C programming?
The basic data type of C
Qualifier
short is the qualifier and int is the basic data type
None of the mentioned
Which of the following is not a correct variable type?
float
real
int
double
What is the only function all C programs must contain?
start()
stdio()
main()
include()
What is the output if the below program is executed?
#include <stdio.h>
int main()
{
int x = 3;
if (x<1)
printf("%d", x);
else
printf("Error");
return 0;
}
3 Error
3Error
3
Error
What is the output if the below program is executed?
#include <stdio.h>
int main()
{
int x = 3;
if (x>1)
printf("%d", x);
printf("Error");
return 0;
}
3 Error
3Error
3
Error
What is the output if the below program is executed?
#include <stdio.h>
int main()
{
int x = 3;
if (x>1)
printf("%d", x);
if(x==3)
printf("%d", x);
else
printf("Error");
return 0;
}
33
3Error
3
Error
What is the output if the below program is executed?
#include <stdio.h>
int main()
{
int x = 3;
if (x>1)
printf("%d", x);
else if(x==3)
printf("%d", x);
else
printf("Error");
return 0;
}
33
3Error
3
Error
What is the output if the below program is executed?
#include <stdio.h>
int main()
{
int x = 5;
if (x<1)
printf("%d", x);
else if(x==3)
printf("%d", x);
else
printf("Error");
return 0;
}
33
3Error
3
Error
What is the output if the below program is executed?
#include <stdio.h>
int main()
{
int x = 2;
switch (x)
{
case 1: printf("%d", x);
case 2: printf("Good morning! ");
case 3: printf("Life is beautiful/n");
}
return 0;
}
3
Good morning!
Good morning!Life is beautiful/n
Good morning!Life is beautiful
