wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Nurs quizizz

Total questions: 85

Worksheet time: 3hrs 50mins

Name
Class
Date
1.

Find the arithmetic operator

a)

X

b)

+

c)

+y

d)

&x

2.

Specify the types of operator

a)

Logical, Bitwise, Arithmetic, Relational

b)

Mathematical, Bitwise, Arithmetic, Relational

c)

Assignment, Bitwise, Arithmetic, Relational

d)

Logical, Bitwise, Assignment, Relational

3.

Logical operators always evaluated from

a)

Right to left

b)

  Not sure

c)

  No difference

d)

Left to right

4.

When an equation uses more than one type of operator then the order of precedence has to be established with the different types of operators:

a)

o       Comparison, logical, arithmetic

b)

o       Logical, arithmetic, comparison

c)

o       Arithmetic, comparison, logical

d)

o       Arithmetic, logical, comparison

5.

Precedence for Logical Operators

a)

OR, NOT, AND

b)

OR, AND, NOT

c)

NOT, AND, OR

d)

AND, OR, NOT

6.

How many times the current loop will execute? for (int i = 0; i <= 5; i += 3);

a)

o 2 times

b)

o 3 times

c)

o Never

d)

o 5 times

7.

8. There are two different ways to implement multi selections in C++ language. They are

a)

o Else – if and switch case

b)

o If… else and switch case

c)

o Else if

d)

o Not sure

8.

9. What is an array?

a)

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier

b)

An array is a series of elements of the different type placed in contiguous memory locations that can be individually referenced by adding an index to a unique.

c)

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by multiplying an index to a unique identifier.

d)

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a same identifier.

9.

12. Which statement of array is true?

a)

o Int foo[5]={10,20,30};

b)

o Int foo[]{10,20,30};

c)

o Int foo[3]={10,20,30};

d)

o Int foo[];

10.

13. What are strings?

a)

o Strings are objects that represent sequences of characters

b)

o Strings are objects that represent sequences of pointers

c)

o Strings are objects that represent sequences of special words

d)

o Strings are objects that represent sequences of structures

11.

14. In which data type we write text

a)

o String

b)

o Int

c)

o Float

d)

o double

12.

15. Choose the right syntax to define a function

a)

o name [parameter1, parameter2]

b)

o type (parameters)

c)

o parameter1, parameter2(name)

d)

o type name(parameter1, parameter2)

13.

17. What are the three steps in using a function?

a)

o Definition, invocation, argument.

b)

o Prototype, argument, signature.

c)

o Definition, prototype, invocation.

14.

18. The factorial function.

a)

o if(n-1){return n*factorial(n-1);} else {return 1;}

b)

o n!=n*(n+1)!

c)

o n!=n-(n-1)! And 1!=1

d)

o n!=n/(n-1)! And 1!=1

15.

19. write mpg() function prototype, that takes two type double arguments and returns a double

a)

Float mpg(int a){ float b = 1; return b;}

b)

Void mpg(){}

c)

Double mpg(double a, double b)

d)

Double mpg(int a, double b)

16.

20. What is data structure?

a)

is a group of data elements grouped together under one name.

b)

is a group of data elements grouped together under two names.

c)

is a set of some elements grouped together under value.

d)

is a group of data elements together with some name.

17.

21. Which of the following are themselves a collection of different data types?

a)

o String

b)

o Structure

c)

o Char

d)

o Integer

18.

22. The data elements in structure are also known as what?

a)

o Objects

b)

o Data

c)

o  Members

d)

o        None of the above

19.

23. What will be used when terminating a structure?

a)

Brackets

b)

Colon

c)

Semicolon

d)

Dot

20.

24. Which of the following is address of operator represented by?

a)

o $

b)

o #

c)

o &

d)

o @

21.

26. What will be used between the object name and the member name?

a)

o Dot

b)

o Semicolon

c)

o Colon

d)

o Anything

22.

27. Which stream class is used to both read and write on files?

a)

● Ifstream

b)

● Ofstream

c)

● Iostream

d)

● Fstream

23.

28. Which stream class is only used to read files?

a)

o Ifstream

b)

o Ofstream

c)

o Iostream

d)

o Fstream

24.

29. Which of the following shows the correct syntax for if statement?

a)

o If expression

b)

o If(expression)

c)

o If{expression}

d)

o Expression if

25.

30. When does the code block following while(x<100) execute?

a)

o While it wishes

b)

o When x is less than one hundred

c)

o When x is greater than one hundred

d)

o When x is equal to one hundred

26.

31. Which of the following properly declares struct?

a)

o struct {int a;}

b)

o struct a_struct {int a;}

c)

o struct a_struct int a;

d)

o struct a_struct {int a;};

27.

32. Which of the following properly declares a variable of struct foo?

a)

o struct foo;

b)

o foo var;

c)

o foo;

d)

o int foo;

28.

33. Which of the following correctly declares an array?

a)

o int anarray[10];

b)

o int anarray;

c)

o anarray{10};

d)

o array anarray[10];

29.

34. What is the difference between array and structure?

a)

o Only on their declaration

b)

o No difference

c)

o Structure can include members of different data types

d)

o Arrays can include only integers

30.

35. There is an array with 29 elements, what is the index number of the last array element?

a)

29

b)

0

c)

28

d)

o Array does not have element’s index

31.

36. What will output from the following program

a)

o Hello will print three times

b)

o Hello will print once

c)

o Hello will print not be printed three times

d)

o Compile error

32.

37. How many times the current loop will execute for (int i = 0; i <= 4; i += 3);?

a)

o 2 times

b)

o 3 times

c)

o 5 times

d)

o infinitely

33.

38. How many times the current loop will execute<xmp>for (int i = 0; i <= 10; i++);</xmp>?

a)

o 11 times

b)

o Never

c)

o 10 times

34.

39. What is the output from the following program code?

a)

10 10 10 10 10

b)

11 11 11 11 11

c)

10

d)

0 1 2 3 4

35.

40. What is the output from the following program?

a)

o 3^4 is 81

b)

o 3^4 is 80

c)

o 3^4 is 12

d)

o 43

36.

41. Write the correct function definition, where function ‘alua’ that takes three integers, x, y and z, and returns an integer?

a)

o double alua(int x, int y, int z)

b)

o int alua(int x, int y, int z)

c)

o intalua(int x, int y)

d)

o intfunct(int x, int y, int z)

37.

42. Write correct function prototype for the function ‘intToDouble’ that takes an integer argument ‘number’, and returns a double value.

a)

o double intToDouble(int number);

b)

o float intToDouble(int number);

c)

o double intToDouble(double number);

d)

o intintToDouble(number);

38.

43. The OR (||) operator:

a)

o Has higher precedence that AND (&&) operator

b)

o Stops evaluation upon finding one condition to be true

c)

o Associates from right to left

d)

o True if all conditions are true

39.

44. Which of the following for headers is not valid for C++ code?

a)

o for (int i = 0; i<9; i++)

b)

o for (int i = 0; i<8; i++)

c)

o for (integer i =0; j<10; i++);

d)

o for (int i = 0; i<7; i++)

40.

45. Which conversion is not possible?

a)

o int to float

b)

o float to int

c)

o char to float

d)

o All are possible

41.

46. What is the correct way to print integer sum to the screen?

a)

o cout << sum << endl;

b)

o cout << “sum” << endl;

c)

o cout >> sum <<endl;

d)

o cout < sum < endl;

42.

47. What will output from the following function printOnNewLine; , if x = 3?

a)

o 3

b)

o 0

c)

o Nothing

d)

o Compile error, because x is int, function is char

43.

48. Which of the following cannot be used to create a random numbers?

a)

o structures

b)

o float

c)

o int

d)

o none of the mentioned

44.

49. What is the correct value to return to the operating system upon the successful completion of a program?

a)

-1

b)

0

c)

1

d)

program doesn’t return a value

45.

50. Which of the following gives the value stored at the address pointed to by the pointer gala?

a)

● gala;

b)

● val(gala);

c)

● *gala;

d)

● &gala;

46.

51. What is the only function all C++ programs must contain?

a)

● start()

b)

● system()

c)

● main()

d)

● program()

47.

52. What punctuation is used to signal the beginning and end of code blocks?

a)

● {}

b)

● -> and

c)

● BEGIN and END

d)

● ( and )

48.

53. What punctuation ends most lines of C++ code?

a)

● . dot

b)

● ; semicolon

c)

● : colon

d)

● , comma

49.

55. Which of the following is not a correct variable type?

a)

● float

b)

● Real

c)

● int

d)

● double

50.

56. Which of the following is the correct operator to compare two variables?

a)

● :=

b)

● =

c)

● equal

d)

● ==

51.

57. Which of the following is true for an integer variable?

a)

1

b)

66

c)

-10

d)

-1

e)

all of them

52.

60. What is the final value of x when the code <xmp>int x; for(x=0; x<50; x++) {} is run?</xmp>

a)

10

b)

50

c)

0

d)

51

53.

61. Which is not a loop structure in C++?

a)

● for

b)

● do while

c)

● while

d)

● repeat until

54.

62. How many times is a do while loop guaranteed to loop?

a)

0

b)

infinitely

c)

1

d)

variable

55.

63. What is the output of the following code?

a)

● value

b)

● 77.5

c)

● float

d)

● variable

56.

64. What is the return type of the function with prototype: "int func(char x, float v, double t);"

a)

● char

b)

● int

c)

● float

d)

● double

57.

65. Which of the following is a valid function call (assuming the function exists)?

a)

● funct@

b)

● funct x, y;

c)

● funct();

d)

● struct funct();

58.

66. Which of the following is a complete function?

a)

● int funct();

b)

● int funct(int x) {return x=x+1;}

c)

● void funct[int] {cout&amp;tl;&lt;&quot;Hello&quot;}

d)

● void funct{x} {cout&lt;&lt;&quot;Hello&quot;}

59.

67. Which of the following is required to avoid falling through from one case to the next?

a)

● end;

b)

● break;

c)

● stop;

d)

● a semicolon;

60.

68. What is the return type of the function with prototype: " float func(char x, float v, double t);"

a)

● char

b)

● int

c)

● float

d)

● double

61.

69. Which of the following is the proper declaration of a pointer?

a)

● int x;

b)

● int &x;

c)

● ptr x;

d)

● int *x;

62.

70. Which of the following gives the memory address of integer variable a?

a)

● *a

b)

● a

c)

● &a

d)

● address(a)

63.

71. Which of the following gives the memory address of a pointer a?

a)

● *a

b)

● a

c)

● &a

d)

● address(a)

64.

72. Which of the following gives the value stored at the address pointed to by the pointer a?

a)

● *a

b)

● a

c)

● &a

d)

● val(a)

65.

73. Which of the following gives the value stored at the address pointed to by the pointer ptr?

a)

● *ptr

b)

● ptr

c)

● &ptr

d)

● val(ptr)

66.

74. Which of the following accesses a variable in structure b?

a)

● b->var;

b)

● b.var;

c)

● b-var;

d)

● b>var;

67.

75. Which of the following accesses a variable in structure mystruct?

a)

● mystruct->var;

b)

● mystruct.var;

c)

● mystruct-var;

d)

● mystruct>var;

68.

76. Which of the following correctly accesses the seventh element stored in alua, an array with 100 elements?

a)

● alua[6];

b)

● alua[7];

c)

● alua(7);

d)

● alua;

69.

77. What character ends all strings?

a)

● ‘,’

b)

● ‘ ’

c)

● ‘\0’

d)

● ‘\n’

70.

78. What would be printed from the following C++ program

a)

● 1 2 7 8

b)

● 1 2 3 5 6 7 8

c)

● 1 2 5 7 8 9

d)

● 2 3 6 8 9

71.

79. What is the correct way to write the condition y < x < z?

a)

● ((y < x) && (x < z))

b)

● ((y < x) | (x < z))

c)

● ( (y < x) & (x<z)

d)

● ((y < x) AND (x < z))

72.

80. The value 132.54 can represented using which data type?

a)

● double

b)

● void

c)

● integer

d)

● bool

73.

81. What is the index number of the last element of an array with 9 elements?

a)

9

b)

8

c)

0

d)

Programmer-defined

74.

83. In an assignment statement“ a=b; ” which of the following statement is true?

a)

● The variable a and the variable b are equal.

b)

● The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a

c)

● The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a

d)

● The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.

75.

84. When following piece of code is executed, what happens, if b=2; a = b++; ?

a)

● a contains 2 and b contains 3

b)

● a contains 3 and b contains 3

c)

● a contains 2 and b contains 2

d)

● a contains 2 and b contains 4

76.

85. Which of the following is output statement in C++?

a)

● print

b)

● write

c)

● cout

d)

● cin

77.

86. Which of the following is input statement in C++?

a)

● cin

b)

● input

c)

● get

d)

● none of them

78.

88. Which of the following is selection statement in C++?

a)

● break

b)

● goto

c)

● exit

d)

● switch

79.

89. Which of the following is not a looping statement in C++?

a)

● while

b)

● until

c)

● do

d)

● for

80.

90. Looping in a program means?

a)

● Jumping to the specified branch of program

b)

● Repeat the specified lines of code

c)

● Both of above

d)

● Both of above

81.

93. We declare a function with ______ if it does not have any return type

a)

● long

b)

● double

c)

● void

d)

● int

82.

94. Arguments of a functions are separated with

a)

● comma (,)

b)

● semicolon(;)

c)

● colon (:)

d)

● none

83.

95. The keyword endl

a)

● Ends the execution of program where it is written

b)

● Ends the line in program. There can be no statements after endl

c)

● Ends current line and starts a new line in cout statement

84.

96. Strings are character arrays. The last index of it contains the null-terminated character

a)

● \n

b)

● \t

c)

● \0

d)

● \1

85.

109. Which of the following is the output from the following C++ code

a)

15 14 13 12 11 10

b)

15 14 13 12 11 10 9

c)

9

d)

15