wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Robotics Quiz

Total questions: 8

Worksheet time: 8mins

Name
Class
Date
1.

How many times will the loop execute?

unsigned char half_limit = 150;
for (unsigned char i = 0; i < 2 * half_limit; ++i)
{
// do something
}

a)

150

b)

500

c)

Infinite

2.

what will be the value of "i" and "j" when the following code is executed?


 int i =10;int\ i\ =10;  
 int j = i++;int\ j\ =\ i++;  

a)

 i =11,  j= 11i\ =11,\ \ j=\ 11  

b)

 i = 11,  j = 10i\ =\ 11,\ \ j\ =\ 10  

c)

 i = 10,  j = 11i\ =\ 10,\ \ j\ =\ 11  

d)

 i = 10,  j = 10i\ =\ 10,\ \ j\ =\ 10  

3.

How do you create a variable with the floating Number 2.8?

a)

int x = 2.8;

b)

x = 2.8;

c)

double x = 2.8;

d)

byte x = 2.8

4.

Which header file lets us work with input and output objects?

a)

#include <stream>

b)

#include <iostream>

c)

#include <inputstr>

d)

#include <iosstring>

5.

How do you start writing a while loop in c++?

a)

x > y whlle {

b)

while x > y {

c)

while x > y:

d)

while (x > y)

6.

what is the correct syntax to output "hello world" in c++?

a)

System.out.println("hello world");

b)

cout << "hello world";

c)

print ("hello world");

d)

Console.Writeline("hello world");

7.

Does both the loops in the following program print the correct string length?

a)

Yes, Both the loops print the correct length

b)

Only for loop prints the correct length

c)

Only while loop prints the correct length

d)

Compile error in the program

8.

What is the output of the program?

a)

5

b)

Address of "x"

c)

Compile error

d)

10