11.&Sh#$J is a type of ________________ data.
- Symbolic
- Alphanumeric
- Alphabetic
- Numeric
Answer
Answer : 1
Explanation : Any data that has symbols should ideally be symbolic data. But, there's no data type as 'symbolic data'. So any combination having symbols and alphabetic/numeric data, will be considered as alphanumeric.
12.Which line of the code is having error in the following program?
#include
int main()
{
char ch = 'D';
float flt = 7.823;
int intgr = 150;
double dbl = 56.243917;
printf("Character is %c \n", ch);
printf("Float value is %f \n", flt);
printf("Integer value is %i\n" , intgr);
printf("Double value is %lf \n", dbl);
return 0;
}
printf("Float value is %f \n", flt)double dbl = 56.243917;printf("Double value is %lf \n", dbl);printf("Integer value is %i\n" , intgr);
Answer
Answer : 4
Explanation : The error with the line of code is that it uses "%i" as format specifier instead of "%d".
13.Which of these is used for generating a newline in the output?
- \t
- \n
- \b
- \l
Answer
Answer : 2
Explanation : \n is used to generate new lines in the output.
14.What will be the output of the following program?
#include
int main()
{
int count=9;
printf("count \n");
printf("%d",count);
}
- 9
9 - count
%d - 9
%d - count
9
Answer
Answer : 4
Explanation : When you write count inside double quotes, the word itself gets printed in the output. And when count is outside the double quotes, and the double quotes has the format specifier %d, it seeks the value of the variable "count". Hence the output is: count
9
15.Which of the following statements is/are correct?
- The value stored in the CPU register can always be accessed faster than that stored in memory
- A register storage class variable will always be stored in a CPU register
- Both the statements are correct
- None of the statements is correct
Answer
Answer : 1
int i = 4;16.What is the output of this C code?
int main()
{
int i = 7;
i = i / 4;
printf("%d \n", i);
return 0;
}
- Run Time Error
- 3
- 1
- Compile Time Error
Answer
Answer : 3Explanation : For 7/4, the quotient will be 1. And hence the output also is 1.
17.Which of the arithmetic operators takes only integers as both the inputs?
- +
- -
- *
- %
- /
Answer
Answer : 4
Explanation : The operator that takes only integers as both the inputs is "%".
18.What is the output of this C code?
void main()
{
int a =9.7 % 2;
printf("Value of a is %d", a);
}
- Value of a is 4
- Value of a is 4.53
- Compile Time Error
- Run Time Error
Answer
Answer : 4
Explanation : In the previous question itself, we saw that % takes both the inputs as integers. But in the current question, the first input is 9.7, which is not an integer and hence, the program will return a compile time error.
19.If the age of a person is given as the input to the computer, it should be able to make a decision on whether he or she is eligible to vote or not. What is the criteria for a person to vote?
- Age should be greater than 18.
- Should be married.
- All of the above
Answer
Answer : 1
Explanation : Now that we are sure about the criteria for voting, how do we instruct this to a computer? Here, the condition is “age > 18”. If that is true then we should print "You are eligible to vote". If the condition is false, then we should go to the end of the if-statement and execute the else-statement - print "You are not eligible to vote".
20.Amongst the following, choose the correct condition to check whether a given number is positive or not?
- The number should be divisible by 2
- The number should be greater than 0a
Answer
Answer : 2
Explanation : Any number greater than 0 is a positive number, otherwise it will be a negative number.
