Java C Control Statement Quiz 2 | Java C Control Question and Answers
Finish Quiz
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
Java C Control Statement Quiz 2 | Java C Control Question and Answers. Test your java fundamentals with our Free Java C Control Statement online test. Java C Control Stmt. Quiz 2 Question and Answers 2024. Java online Test Quiz 2. Java C Control Stmt. Quiz 2 Free Mock Test 2024. Java C Control Stmt. Quiz 2 Question and Answers in PDF. The Java online mock test paper is free for all students. Spring Online is very useful for exam preparation and getting for Rank. Java C Control Stmt. Quiz 2 Question and Answers in English. Java C Control Stmt. Mock test for topic via C Control Stmt. Mode. Here we are providing Java C Control Stmt. Quiz in English Now Test your self for “C Control Stmt. Online Quiz in English” Exam by using below quiz…
This paper has 20 questions.
Time allowed is 25 minutes.
The Java C Control Stmt. Mock Test is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 20 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
The way the break is used to take control out of switch and continue to take control of the beginning of the switch?
Correct
continue can work only with loops and not with switch
Incorrect
continue can work only with loops and not with switch
-
Question 2 of 20
2. Question
How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf(“%c %d “, j, j);
j++;
}
return 0;
}Correct
The while(j <= 255) loop will get executed 255 times. The size short int(2 byte wide) does not affect the while() loop.
Incorrect
The while(j <= 255) loop will get executed 255 times. The size short int(2 byte wide) does not affect the while() loop.
-
Question 3 of 20
3. Question
How many times “javatpoint” is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf(“javatpoint”);
}
return 0;
}Correct
Incorrect
-
Question 4 of 20
4. Question
Can we use a switch statement to switch on strings?
Correct
The cases in a switch must either have integer constants or constant expressions.
Incorrect
The cases in a switch must either have integer constants or constant expressions.
-
Question 5 of 20
5. Question
Which of the following is not logical operator?
Correct
Incorrect
-
Question 6 of 20
6. Question
By default, the data type of a constant without a decimal point is int, whereas the one with a decimal point is a double.
Correct
6 is int constant.
6.68 is double.
6.68L is long double constant.
6.68f is float constant.Incorrect
6 is int constant.
6.68 is double.
6.68L is long double constant.
6.68f is float constant. -
Question 7 of 20
7. Question
We want to test whether a value lies in the range 2 to 4 or 5 to 7. Can we do this using a switch?
Correct
We can do this in following switch statement
switch(a)
{
case 2:
case 3:
case 4:
/* some statements */
break;
case 5:
case 6:
case 7:
/* some statements */
break;
}Incorrect
We can do this in following switch statement
switch(a)
{
case 2:
case 3:
case 4:
/* some statements */
break;
case 5:
case 6:
case 7:
/* some statements */
break;
} -
Question 8 of 20
8. Question
In mathematics and computer programming, which is the correct order of mathematical operators ?
Correct
Simply called as BODMAS (Brackets, Order, Division, Multiplication, Addition and Subtraction).
Mnemonics are often used to help students remember the rules, but the rules taught by the use of acronyms can be misleading. In the United States the acronym PEMDAS is common. It stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. In other English speaking countries, Parentheses may be called Brackets, or symbols of inclusion and Exponentiation may be called either Indices, Powers or Orders, and since multiplication and division are of equal precedence, M and D are often interchanged, leading to such acronyms as BEDMAS, BIDMAS, BODMAS, BERDMAS, PERDMAS, and BPODMAS.Incorrect
Simply called as BODMAS (Brackets, Order, Division, Multiplication, Addition and Subtraction).
Mnemonics are often used to help students remember the rules, but the rules taught by the use of acronyms can be misleading. In the United States the acronym PEMDAS is common. It stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. In other English speaking countries, Parentheses may be called Brackets, or symbols of inclusion and Exponentiation may be called either Indices, Powers or Orders, and since multiplication and division are of equal precedence, M and D are often interchanged, leading to such acronyms as BEDMAS, BIDMAS, BODMAS, BERDMAS, PERDMAS, and BPODMAS. -
Question 9 of 20
9. Question
Which of the following cannot be checked in a switch-case statement?
Correct
The switch/case statement in the c language is defined by the language specification to use an int value, so you can not use a float value.
Incorrect
The switch/case statement in the c language is defined by the language specification to use an int value, so you can not use a float value.
-
Question 10 of 20
10. Question
Which of the following statements are correct about the below C-program?
#include<stdio.h>
int main()
{
int x = 10, y = 100%90, i;
for(i=1; i<10; i++)
if(x != y);
printf(“x = %d y = %d”, x, y);
return 0;
}
1 : The printf() function is called 10 times.
2 : The program will produce the output x = 10 y = 10
3 : The ; after the if(x!=y) will NOT produce an error.
4 : The program will not produce output.Correct
Incorrect
-
Question 11 of 20
11. Question
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
int n = 0, y = 1;
y == 1 ? n=0 : n=1;
if(n)
printf(“Yes “);
else
printf(“No “);
return 0;
}Correct
Incorrect
-
Question 12 of 20
12. Question
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
int i = 10, j = 20;
if(i = 5) && if(j = 10)
printf(“Have a nice day”);
return 0;
}Correct
“Expression syntax” error occur in this line if(i = 5) && if(j = 10).
It should be like if((i == 5) && (j == 10)).Incorrect
“Expression syntax” error occur in this line if(i = 5) && if(j = 10).
It should be like if((i == 5) && (j == 10)). -
Question 13 of 20
13. Question
Which of the following statements are correct about the below C-program?
#include<stdio.h>
int main()
{
int x = 10, y = 100%90, i;
for(i=1; i<10; i++)
if(x != y);
printf(“x = %d y = %d “, x, y);
return 0;
}1 : The printf() function is called 10 times.
2 : The program will produce the output x = 10 y = 10
3 : The ; after the if(x!=y) will NOT produce an error.
4 : The program will not produce output.Correct
Incorrect
-
Question 14 of 20
14. Question
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
int i = 10, j = 15;
if(i % 2 = j % 3)
printf(“IndiaBIX “);
return 0;
}Correct
if(i % 2 = j % 3) This statement generates “LValue required error”. There is no variable on the left side of the expression to assign (j % 3).
Incorrect
if(i % 2 = j % 3) This statement generates “LValue required error”. There is no variable on the left side of the expression to assign (j % 3).
-
Question 15 of 20
15. Question
Which of the following sentences are correct about a switch loop in a C program?
1: switch is useful when we wish to check the value of variable against a particular set of values.
2: switch is useful when we wish to check whether a value falls in different ranges.
3: Compiler implements a jump table for cases used in switch.
4: It is not necessary to use a break in every switch statement.Correct
Incorrect
-
Question 16 of 20
16. Question
Point out the error, if any in the for loop.
#include<stdio.h>
int main()
{
int i=1;
for(;;)
{
printf(“%d “, i++);
if(i>10)
break;
}
return 0;
}Correct
Step 1: for(;;) this statement will genereate infinite loop.
Step 2: printf(“%d “, i++); this statement will print the value of variable i and increement i by 1(one).
Step 3: if(i>10) here, if the variable i value is greater than 10, then the for loop breaks.
Hence the output of the program is
1
2
3
4
5
6
7
8
9
10Incorrect
Step 1: for(;;) this statement will genereate infinite loop.
Step 2: printf(“%d “, i++); this statement will print the value of variable i and increement i by 1(one).
Step 3: if(i>10) here, if the variable i value is greater than 10, then the for loop breaks.
Hence the output of the program is
1
2
3
4
5
6
7
8
9
10 -
Question 17 of 20
17. Question
Which of the following statements are correct about the below program?
#include<stdio.h>
int main()
{
int i = 0;
i++;
if(i <= 5)
{
printf(“Javatpoint “);
exit(0);
main();
}
return 0;
}
Correct
Incorrect
-
Question 18 of 20
18. Question
Which of the following statements are correct about an if-else statements in a C-program?
1: Every if-else statement can be replaced by an equivalent statements using ?: operators
2: Nested if-else statements are allowed.
3: Multiple statements in an if block are allowed.
4: Multiple statements in an else block are allowed.Correct
Incorrect
-
Question 19 of 20
19. Question
Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
int x = 30, y = 40;
if(x == y)
printf(“x is equal to y “);else if(x > y)
printf(“x is greater than y “);else if(x < y)
printf(“x is less than y “)
return 0;
}Correct
This program will result in error “Statement missing ;”
printf(“x is less than y “) here ; should be added to the end of this statement.Incorrect
This program will result in error “Statement missing ;”
printf(“x is less than y “) here ; should be added to the end of this statement. -
Question 20 of 20
20. Question
Which of the following sentences are correct about a for loop in a C program?
1: for loop works faster than a while loop.
2: All things that can be done using a for loop can also be done using a whileloop.
3: for(;;); implements an infinite loop.
4: for loop can be used if we want statements in a loop get executed at least once.Correct
Incorrect