WorksheetsUC_TM02_C Programming Basics
Total questions: 16
Worksheet time: 7mins
Which of the following statement is false?
Name of the variable can have letters,digits and underscore
Upper case and Lower case letters are distinct in C
Variable name can begin with digit
Variable name cannot have C reserved words
To calculate the remainder which of the following option is used?
a mod b
a%b
a/b
a^b
Which of the following is not a valid data type?
char
int
short
bigint
What will be the output ?
int main()
{
int x=10,y=20,res;
res = (x < y) ? x : y;
printf("output %d " , res);
return 0;
}
compile error
10
20
run time error
Char datatype will be allocate storage size of ?
2 byte
4 byte
8 byte
1 byte
which of the following is not a valid identifier?
1empno
emp_1_no
empno1
emp_no1
Which of the below is not a built in or primary datatype in C?
int
char
float
enum
What will the output of the following code?
int main() {
const int X = 10;
X=20;
printf("value of x : %d",X);
return 0;
}
10
20
compile error: assignment of read-only variable ‘X’
run time error
What will be displayed as the value of x?
int main() {
int x;
x=(10%2+5/2*3);
printf("value of x is : %d " , x);
return 0;
}
6
1
7
0
What will be the output of the below code?
int main() {
int x=10;
int y;
y=x++;
printf("value of x is : %d %d " , x , y);
return 0;
}
11 11
11 10
10 10
10 11
What will be output?
int main() {
int x=10;
printf("value of x is : %d " , sizeof(x));
return 0;
}
2
compile error
4
run time error
What will the output?
int main() {
int x=1,n=5;
do{
printf(" %d ",x);
x=x+1;
}while(n>5);
return 0;
}
1 2 3 4 5
1 2 3 4
1
1 2
Which statement terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch.
end
break
goto
none of the above
The _________header file which contains the input output functions .
input.h
inpout.h
stdio.h
output.h
An integer literal can have ________ constant.
decimal
octal
hexadecimal
all of the above
What will be output of the following code?
int main() {
int x=10;
char ch='a';
printf("%d",x+ch);
return 0;
}
107
compile error
run time error
10a
