Font size
WorksheetsNurs quizizz
Total questions: 85
Worksheet time: 3hrs 50mins
Find the arithmetic operator
X
+
+y
&x
Specify the types of operator
Logical, Bitwise, Arithmetic, Relational
Mathematical, Bitwise, Arithmetic, Relational
Assignment, Bitwise, Arithmetic, Relational
Logical, Bitwise, Assignment, Relational
Logical operators always evaluated from
Right to left
Not sure
No difference
Left to right
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:
o Comparison, logical, arithmetic
o Logical, arithmetic, comparison
o Arithmetic, comparison, logical
o Arithmetic, logical, comparison
Precedence for Logical Operators
OR, NOT, AND
OR, AND, NOT
NOT, AND, OR
AND, OR, NOT
How many times the current loop will execute? for (int i = 0; i <= 5; i += 3);
o 2 times
o 3 times
o Never
o 5 times
8. There are two different ways to implement multi selections in C++ language. They are
o Else – if and switch case
o If… else and switch case
o Else if
o Not sure
9. What is an array?
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
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.
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.
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.
12. Which statement of array is true?
o Int foo[5]={10,20,30};
o Int foo[]{10,20,30};
o Int foo[3]={10,20,30};
o Int foo[];
13. What are strings?
o Strings are objects that represent sequences of characters
o Strings are objects that represent sequences of pointers
o Strings are objects that represent sequences of special words
o Strings are objects that represent sequences of structures
14. In which data type we write text
o String
o Int
o Float
o double
15. Choose the right syntax to define a function
o name [parameter1, parameter2]
o type (parameters)
o parameter1, parameter2(name)
o type name(parameter1, parameter2)
17. What are the three steps in using a function?
o Definition, invocation, argument.
o Prototype, argument, signature.
o Definition, prototype, invocation.
18. The factorial function.
o if(n-1){return n*factorial(n-1);} else {return 1;}
o n!=n*(n+1)!
o n!=n-(n-1)! And 1!=1
o n!=n/(n-1)! And 1!=1
19. write mpg() function prototype, that takes two type double arguments and returns a double
Float mpg(int a){ float b = 1; return b;}
Void mpg(){}
Double mpg(double a, double b)
Double mpg(int a, double b)
20. What is data structure?
is a group of data elements grouped together under one name.
is a group of data elements grouped together under two names.
is a set of some elements grouped together under value.
is a group of data elements together with some name.
21. Which of the following are themselves a collection of different data types?
o String
o Structure
o Char
o Integer
22. The data elements in structure are also known as what?
o Objects
o Data
o Members
o None of the above
23. What will be used when terminating a structure?
Brackets
Colon
Semicolon
Dot
24. Which of the following is address of operator represented by?
o $
o #
o &
o @
26. What will be used between the object name and the member name?
o Dot
o Semicolon
o Colon
o Anything
27. Which stream class is used to both read and write on files?
● Ifstream
● Ofstream
● Iostream
● Fstream
28. Which stream class is only used to read files?
o Ifstream
o Ofstream
o Iostream
o Fstream
29. Which of the following shows the correct syntax for if statement?
o If expression
o If(expression)
o If{expression}
o Expression if
30. When does the code block following while(x<100) execute?
o While it wishes
o When x is less than one hundred
o When x is greater than one hundred
o When x is equal to one hundred
31. Which of the following properly declares struct?
o struct {int a;}
o struct a_struct {int a;}
o struct a_struct int a;
o struct a_struct {int a;};
32. Which of the following properly declares a variable of struct foo?
o struct foo;
o foo var;
o foo;
o int foo;
33. Which of the following correctly declares an array?
o int anarray[10];
o int anarray;
o anarray{10};
o array anarray[10];
34. What is the difference between array and structure?
o Only on their declaration
o No difference
o Structure can include members of different data types
o Arrays can include only integers
35. There is an array with 29 elements, what is the index number of the last array element?
29
0
28
o Array does not have element’s index
36. What will output from the following program
o Hello will print three times
o Hello will print once
o Hello will print not be printed three times
o Compile error
37. How many times the current loop will execute for (int i = 0; i <= 4; i += 3);?
o 2 times
o 3 times
o 5 times
o infinitely
38. How many times the current loop will execute<xmp>for (int i = 0; i <= 10; i++);</xmp>?
o 11 times
o Never
o 10 times
39. What is the output from the following program code?
10 10 10 10 10
11 11 11 11 11
10
0 1 2 3 4
40. What is the output from the following program?
o 3^4 is 81
o 3^4 is 80
o 3^4 is 12
o 43
41. Write the correct function definition, where function ‘alua’ that takes three integers, x, y and z, and returns an integer?
o double alua(int x, int y, int z)
o int alua(int x, int y, int z)
o intalua(int x, int y)
o intfunct(int x, int y, int z)
42. Write correct function prototype for the function ‘intToDouble’ that takes an integer argument ‘number’, and returns a double value.
o double intToDouble(int number);
o float intToDouble(int number);
o double intToDouble(double number);
o intintToDouble(number);
43. The OR (||) operator:
o Has higher precedence that AND (&&) operator
o Stops evaluation upon finding one condition to be true
o Associates from right to left
o True if all conditions are true
44. Which of the following for headers is not valid for C++ code?
o for (int i = 0; i<9; i++)
o for (int i = 0; i<8; i++)
o for (integer i =0; j<10; i++);
o for (int i = 0; i<7; i++)
45. Which conversion is not possible?
o int to float
o float to int
o char to float
o All are possible
46. What is the correct way to print integer sum to the screen?
o cout << sum << endl;
o cout << “sum” << endl;
o cout >> sum <<endl;
o cout < sum < endl;
47. What will output from the following function printOnNewLine; , if x = 3?
o 3
o 0
o Nothing
o Compile error, because x is int, function is char
48. Which of the following cannot be used to create a random numbers?
o structures
o float
o int
o none of the mentioned
49. What is the correct value to return to the operating system upon the successful completion of a program?
-1
0
1
program doesn’t return a value
50. Which of the following gives the value stored at the address pointed to by the pointer gala?
● gala;
● val(gala);
● *gala;
● &gala;
51. What is the only function all C++ programs must contain?
● start()
● system()
● main()
● program()
52. What punctuation is used to signal the beginning and end of code blocks?
● {}
● -> and
● BEGIN and END
● ( and )
53. What punctuation ends most lines of C++ code?
● . dot
● ; semicolon
● : colon
● , comma
55. Which of the following is not a correct variable type?
● float
● Real
● int
● double
56. Which of the following is the correct operator to compare two variables?
● :=
● =
● equal
● ==
57. Which of the following is true for an integer variable?
1
66
-10
-1
all of them
60. What is the final value of x when the code <xmp>int x; for(x=0; x<50; x++) {} is run?</xmp>
10
50
0
51
61. Which is not a loop structure in C++?
● for
● do while
● while
● repeat until
62. How many times is a do while loop guaranteed to loop?
0
infinitely
1
variable
63. What is the output of the following code?
● value
● 77.5
● float
● variable
64. What is the return type of the function with prototype: "int func(char x, float v, double t);"
● char
● int
● float
● double
65. Which of the following is a valid function call (assuming the function exists)?
● funct@
● funct x, y;
● funct();
● struct funct();
66. Which of the following is a complete function?
● int funct();
● int funct(int x) {return x=x+1;}
● void funct[int] {cout&tl;<"Hello"}
● void funct{x} {cout<<"Hello"}
67. Which of the following is required to avoid falling through from one case to the next?
● end;
● break;
● stop;
● a semicolon;
68. What is the return type of the function with prototype: " float func(char x, float v, double t);"
● char
● int
● float
● double
69. Which of the following is the proper declaration of a pointer?
● int x;
● int &x;
● ptr x;
● int *x;
70. Which of the following gives the memory address of integer variable a?
● *a
● a
● &a
● address(a)
71. Which of the following gives the memory address of a pointer a?
● *a
● a
● &a
● address(a)
72. Which of the following gives the value stored at the address pointed to by the pointer a?
● *a
● a
● &a
● val(a)
73. Which of the following gives the value stored at the address pointed to by the pointer ptr?
● *ptr
● ptr
● &ptr
● val(ptr)
74. Which of the following accesses a variable in structure b?
● b->var;
● b.var;
● b-var;
● b>var;
75. Which of the following accesses a variable in structure mystruct?
● mystruct->var;
● mystruct.var;
● mystruct-var;
● mystruct>var;
76. Which of the following correctly accesses the seventh element stored in alua, an array with 100 elements?
● alua[6];
● alua[7];
● alua(7);
● alua;
77. What character ends all strings?
● ‘,’
● ‘ ’
● ‘\0’
● ‘\n’
78. What would be printed from the following C++ program
● 1 2 7 8
● 1 2 3 5 6 7 8
● 1 2 5 7 8 9
● 2 3 6 8 9
79. What is the correct way to write the condition y < x < z?
● ((y < x) && (x < z))
● ((y < x) | (x < z))
● ( (y < x) & (x<z)
● ((y < x) AND (x < z))
80. The value 132.54 can represented using which data type?
● double
● void
● integer
● bool
81. What is the index number of the last element of an array with 9 elements?
9
8
0
Programmer-defined
83. In an assignment statement“ a=b; ” which of the following statement is true?
● The variable a and the variable b are equal.
● The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a
● The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a
● The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.
84. When following piece of code is executed, what happens, if b=2; a = b++; ?
● a contains 2 and b contains 3
● a contains 3 and b contains 3
● a contains 2 and b contains 2
● a contains 2 and b contains 4
85. Which of the following is output statement in C++?
● write
● cout
● cin
86. Which of the following is input statement in C++?
● cin
● input
● get
● none of them
88. Which of the following is selection statement in C++?
● break
● goto
● exit
● switch
89. Which of the following is not a looping statement in C++?
● while
● until
● do
● for
90. Looping in a program means?
● Jumping to the specified branch of program
● Repeat the specified lines of code
● Both of above
● Both of above
93. We declare a function with ______ if it does not have any return type
● long
● double
● void
● int
94. Arguments of a functions are separated with
● comma (,)
● semicolon(;)
● colon (:)
● none
95. The keyword endl
● Ends the execution of program where it is written
● Ends the line in program. There can be no statements after endl
● Ends current line and starts a new line in cout statement
96. Strings are character arrays. The last index of it contains the null-terminated character
● \n
● \t
● \0
● \1
109. Which of the following is the output from the following C++ code
15 14 13 12 11 10
15 14 13 12 11 10 9
9
15
