Font size
WorksheetsAI-Quiz3
Total questions: 109
Worksheet time: 1hrs 24mins
RABBIT
RABBIT is printed unlimited number of times.
No output
Compiler error
RABBIT
RABBIT is printed unlimited number of times.
No output
Compiler error
GREEN
RABBIT
GREEN
RABBIT is printed unlimited number of times.
Compiler error.
GREEN
RABBIT
GREEN
RABBIT is printed unlimited number of times.
None of the above
25 25 25
25 26 27
27 27 27
Compiler error
No Output
32 33 34
32 33 34 35
Compiler error
compiler error
10 10 10 10 10
10 11 12 13 14 15
None of the above
No Output
TESTING
Compiler error
None of the above
Compiler error
FLOWER FRUITS
FLOWER YELLOW
FLOWER YELLOW FRUITS
Compilation Error
1 2 3 1 2 3
1 1 2 2 3 3
None of the above
99
102
109
None of the above
1 2 3 0
1 1 2 2
2 1 3 0
0 1 2 3
4--6
6--
4--
None of the above
Compilation error
-128
0
1
127
128
Program never ends
0
Nothing prints
for
for for for
None of the above
Compilation error
Program never ends
loop loop loop loop loop
None of these
Compilation error
Program never ends
Hello
None of the above
2 4
No output
2 4 6
Program never ends
Compilation error
1 2 3
4
0 1 2 3
Select different parts of "for" looping statement-
Initialization part
Condition Part
Update part
All of these
What will be the output of following code- for(int i = 1; i < 5; i++ )
{
System.out.print(i);
}
13
135
1234
12345
_________ in programming come into use when we need to repeatedly execute a block of statements.
nested for loop
none
for loop
loop
The __________ statement uses single expression for multiple choices
loop
switch
multiple value
if else
in __________ the controlling condition appears at the start of the loop and _______ at the end of the loop
While / Do while
Do while/While
None
What is an Array?
A group of elements of same data type.
An array contains more than one element
Array elements are stored in memory in continuous or contiguous locations.
All the above.
In general, the index of the first element in an array is __________
0
-1
2
1
What is meaning of following
declaration ?
int arr[20];
Array of size 20 that can have integer address
Array of Size 20
Integer Array of size 20
None of these
Assuming int is of 2 bytes, what is the size of int arr[15];?
15
19
11
30
What is the length of the following array: int data[] = { 12, 34, 9, 0, -62, 88 };
1
5
6
12
If we have declared an array described below -
int arr[6];
then which of the following array element is considered as last array element ?
arr[6]
arr[4]
arr[0]
arr[5]
All the arithmetic operators operate on (a) associativity.
The symbol used for conditional operator is _____
?:
=
++
>=
The word algorithm is derived from the following
a. AL-KHOWARIZMI
b. AL-AHMED
c. AL-JAFAR
d. AL-MURA
The special function called ____ is where program execution begins.
a. Add
b. Sub
c. Main
d. Multi
Escape sequence _______ represents bell sound.
a. \n
b. \a
c. \t
d. \b
The meaning of the operator ______ is modulus in C language.
a. ++
b. mod
c. %
d. *
In the following declaration,
int sum(int , int);
How many parameters are declared?
a. 4
b.6
c. 2
d. 3
Function declaration or function prototype has ____ components.
a. 4
b. 7
c. 9
d. 3
Which loop is faster in C Language, for, while or Do While.?
for
while
do while
All of the given
Choose correct C while loop syntax.
while(condition)
{
//statements
}
{
//statements
}while(condition)
while(condition);
{
//statements
}
while()
{
if(condition)
{
//statements
}
}
Choose a correct C for loop syntax.
for(initalization; condition; incrementoperation)
{
//statements
}
for(declaration; condition; incrementoperation)
{
//statements
}
for(declaration; incrementoperation; condition)
{
//statements
}
for(initalization; condition; incrementoperation;)
{
//statements
}
Choose a correct C do while syntax.
dowhile(condition)
{
//statements
}
do while(condition)
{
//statements
}
do
{
//statements
}while(condition);
do
{
//statements
}while(condition)
What is the output of C Program.?
int main()
{
while(true)
{
printf("RABBIT");
break;
}
return 0;
}
RABBIT
RABBIT is printed unlimited number of times.
No output
Compiler error.
What is the output of C Program.?
int main()
{ int a=5;
while(a=123)
{ printf("RABBIT\n");
break;
}
printf("GREEN");
return 0;
}
GREEN
RABBIT
GREEN
RABBIT is printed unlimited number of times.
Compiler error.
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
}while(a <= 30);
return 0;
}
32
33
30
No Output
What is the output of C Program.?
int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}
1 2 3 4 5
1 2 3 4
6
5
What is the output of C Program.?
int main()
{ int a=14;
while(a<20)
{ ++a;
if(a>=16 && a<=18)
{ continue; }
printf("%d ", a);
}
return 0;
}
15 16 17 18 19
15 18 19
15 16 20
15 19 20
What is the output of C Program.?
int main()
{
int a=10, b, c;
b=a++;
c=++a;
printf("%d %d %d", a, b, c);
return 0;
}
10 11 12
12 10 12
12 11 12
12 12 12
What is the output of C Program.?
int main()
{
int k;
for(k=1; k <= 5; k++)
{ printf("%d ", k);
}
return 0;
}
1 2 3 4
1 2 3 4 5
6
5
Loops in C Language are implemented using.?
While
Do - While
For
All
Which loop is faster in C Language, for, while or Do While.?
For
While
Do - while
All
What is the output of C Program.?
int main()
{
while(true)
{ printf("RABBIT");
break;
}
return 0;
}
RABBIT
RABBIT is printed unlimited number of times.
No output
Compiler error.
Choose a correct C do while syntax.
dowhile(condition) { //statements }
do while(condition)
{ //statements }
do { //statements }while(condition)
do { //statements }while(condition);
What is the output of C Program.?
int main()
{
int a=25;
while(a <= 27)
{ printf("%d ", a);
a++;
}
return 0;
}
25 25 25
25 26 27
compiler error
25 26
Choose a correct C for loop syntax.
for(initalization; Expression; Update Expression)
{ //statements }
for(declaration; condition; incrementoperation);
{ //statements }
for(declaration; incrementoperation; condition)
//statements
Select different parts of "for" looping statement-
Initialization part
Condition Part
Update part
All of these
What will be the output of following code- for(int i = 1; i < 5; i++ )
{
System.out.print(i);
}
13
135
1234
12345
_________ in programming come into use when we need to repeatedly execute a block of statements.
nested for loop
none
for loop
loop
The __________ statement uses single expression for multiple choices
loop
switch
multiple value
if else
in __________ the controlling condition appears at the start of the loop and _______ at the end of the loop
While / Do while
Do while/While
None
What is an Array?
A group of elements of same data type.
An array contains more than one element
Array elements are stored in memory in continuous or contiguous locations.
All the above.
In general, the index of the first element in an array is __________
0
-1
2
1
What is meaning of following
declaration ?
int arr[20];
Array of size 20 that can have integer address
Array of Size 20
Integer Array of size 20
None of these
Assuming int is of 2 bytes, what is the size of int arr[15];?
15
19
11
30
The symbol used for conditional operator is _____
?:
=
++
>=
The special function called ____ is where program execution begins.
a. Add
b. Sub
c. Main
d. Multi
Escape sequence _______ represents bell sound.
a. \n
b. \a
c. \t
d. \b
The meaning of the operator ______ is modulus in C language.
a. ++
b. mod
c. %
d. *
Which loop is faster in C Language, for, while or Do While.?
for
while
do while
All of the given
Choose correct C while loop syntax.
while(condition)
{
//statements
}
{
//statements
}while(condition)
while(condition);
{
//statements
}
while()
{
if(condition)
{
//statements
}
}
Choose a correct C for loop syntax.
for(initalization; condition; incrementoperation)
{
//statements
}
for(declaration; condition; incrementoperation)
{
//statements
}
for(declaration; incrementoperation; condition)
{
//statements
}
for(initalization; condition; incrementoperation;)
{
//statements
}
Choose a correct C do while syntax.
dowhile(condition)
{
//statements
}
do while(condition)
{
//statements
}
do
{
//statements
}while(condition);
do
{
//statements
}while(condition)
What is the output of C Program.?
int main()
{
while(true)
{
printf("RABBIT");
break;
}
return 0;
}
RABBIT
RABBIT is printed unlimited number of times.
No output
Compiler error.
What is the output of C Program.?
int main()
{ int a=5;
while(a=123)
{ printf("RABBIT\n");
break;
}
printf("GREEN");
return 0;
}
GREEN
RABBIT
GREEN
RABBIT is printed unlimited number of times.
Compiler error.
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
}while(a <= 30);
return 0;
}
32
33
30
No Output
What is the output of C Program.?
int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}
1 2 3 4 5
1 2 3 4
6
5
What is the output of C Program.?
int main()
{ int a=14;
while(a<20)
{ ++a;
if(a>=16 && a<=18)
{ continue; }
printf("%d ", a);
}
return 0;
}
15 16 17 18 19
15 18 19
15 16 20
15 19 20
What is the output of C Program.?
int main()
{
int a=10, b, c;
b=a++;
c=++a;
printf("%d %d %d", a, b, c);
return 0;
}
10 11 12
12 10 12
12 11 12
12 12 12
Which of the following is an entry controlled statement?
while
do while
For
Which of the following is an exit controlled loop?
while
do while
for
The while loop executes at least once.the statement is
True
False
do while loop executes at least once.the statement is
True
False
In the following loop construct, which one is executed only once always.
for(exp1; exp2; exp3)
exp1
exp2
exp3
All of these
do-while loop terminates when conditional expression returns?
One
Zero
Non zero
None of these
A ________________ executes the sequence of statements many times until the stated condition becomes false.
data structures
control structures
loop
OOPS
The _____________ is used in many imperative programming languages notably C and C++.
do loop
for loop
while loop
do while loop
A ____________ is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition.
while loop
do loop
for loop
do while loop
A ______________ is a control flow statement that executes a block of code at least once.
do loop
do while loop
while loop
for loop
A _____________ is used to repeat a specific block of code a known number of times.
do loop
for loop
do while loop
while loop
The ______________ can be thought of as a repeating if statement.
do while loop
do loop
while loop
for loop
____________________ either repeatedly executes the block, or stops executing it, depending on a given boolean condition at the end of the block.
for loop
do loop
do while loop
while loop
If we have declared an array described below -
int arr[6];
then which of the following array element is considered as last array element ?
arr[6]
arr[4]
arr[0]
arr[5]
What is the length of the following array: int data[] = { 12, 34, 9, 0, -62, 88 };
1
5
6
12
Assuming int is of 2 bytes, what is the size of int arr[15];?
15
19
11
30
What is meaning of following
declaration ?
int arr[20];
Array of size 20 that can have integer address
Array of Size 20
Integer Array of size 20
None of these
In general, the index of the first element in an array is __________
0
-1
2
1
What is the output of C Program.?
int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}
1 2 3 4 5
1 2 3 4
6
5
What's wrong? for (int k = 2, k <=12, k++)
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
What output is produced by the following segment of code:
for (int dmc = 8; dmc >= 0; dmc-=4)
{
printf("%d",dmc);
}
8 4 0
8 4
8
No Output
Infinite Loop
What output is produced by the following segment of code:
for (int dmc = 8; dmc >= 8; dmc-=4)
{
printf("%d",dmc);
}
8 4 0
8 4
8
No Output
Infinite Loop
What output is produced by the following segment of code:
for (int dmc = 8; dmc >= 10; dmc-=4)
{
printf("%d",dmc);
}
* * *
* *
*
No Output
Infinite Loop
What output is produced by the following segment of code:
int x;
for (x = 10; x > 0; x++)
{
printf("%d",x)
}
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1 0
9 8 7 6 5 4 3 2 1
No Output
Infinite Loop
What output is produced by the following segment of code:
for (int x = 5; x > 0; x--)
{
printf("* ");
}
* * * * *
* * * * * *
*
No Output
Infinite Loop
The following loop displays _______________.
for (int i = 1; i <= 10; i++) {
printf("%d",i);
i++;
}
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5
1 3 5 7 9
What is the output for y?
int y = 0;
int i;
for (i = 0; i<10; ++i) {
y += i;
}
printf("%d",y);
1
36
45
9
What is the number of iterations in the following loop:
for (i = 1; i < n; i++) {
// iteration
}
2*n
n
n - 1
n + 1
