Algoritmiz

Create an image of a friendly computer with a brain, surrounded by algorithm symbols like arrows, data structures, and programming code, in a colorful and engaging style.

Algorithm Knowledge Quiz

Welcome to the Algorithm Knowledge Quiz! This quiz is designed to test your understanding of algorithms, data structures, and programming concepts. Whether you are a student eager to enhance your skills or a seasoned programmer looking to refresh your knowledge, this quiz is for you!

  • Multiple choice questions covering key topics.
  • Assess your comprehension of logic, arrays, functions, and more.
  • Challenge yourself and learn as you go!
106 Questions26 MinutesCreated by CodingMaster42
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:
Comparison, logical, arithmetic
Logical, arithmetic, comparison
Arithmetic, comparison, logical
Arithmetic, logical, comparison
Precedence for Logical Operators
OR, NOT, AND
OR, AND, NOT
NOT, AND, OR
AND, OR, NOT
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.
When an array is partially initialized, the rest of its elements will automatically be set to zero.
True
False
Nothing
All of them
The whole array can be passed to a function. However, it can't be changed by the code in that function
True
Nothing
All of them
False
What are the three steps in using a function?
Definition, invocation, argument.
Prototype, argument, signature.
Definition, prototype, invocation.
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)
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.
The data elements in structure are also known as what?
Objects
Data
Members
None of the above
What will be used when terminating a structure?
Brackets
Colon
Semicolon
Dot
Which stream class is used to both read and write on files?
Ifstream
Ofstream
Iostream
Fstream
Which stream class is only used to read files?
Ifstream
Ofstream
Iostream
Fstream
What is the difference between array and structure?
Only on their declaration
No difference
Structure can include members of different data types
Arrays can include only integers
17. The OR (||) operator:
Has higher precedence that AND (&&) operator
Stops evaluation upon finding one condition to be true
Associates from right to left
True if all conditions are true
Which of the following for headers is not valid for C++ code?
for (int I = 0; i<9; i++)
for (int I = 0; i<8; i++)
for (integer I =0; j<10; i++);
for (int I = 0; i<7; i++)
all
There might be functions with the same name, but different arguments. The function called is the one whose arguments match the invocation. What is this mean?
Function overloading
Function overprocessing
Argument type error
Argument dispatch error
Which of the following cannot be used to create a random numbers?
structures
float
int
none of the mentioned
Please evaluate !(1 && !(0 || 1)).
True
False
Unevaluatable
Not sure
How many times is a do while loop guaranteed to loop?
0
Infinitely
1
Variable
What is the final value of x when the code int x; for(x=0; x<50; x++) {} is run?
10
50
0
51
Which of the following is a valid function call (assuming the function exists)?
funct;
funct x, y;
funct();
struct funct();
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"}
Which of the following is required to avoid falling through from one case to the next?
End;
Break;
Stop;
A semicolon;
Which of the following is the proper declaration of a pointer?
int x;
int &x;
ptr x;
int *x;
Which of the following gives the memory address of integer variable a?
*a;
a;
&a;
address(a);
Which of the following gives the memory address of a pointer a?
a;
*a;
&a;
address(a);
Which of the following gives the value stored at the address pointed to by the pointer a?
a;
val(a);
*a;
&a;
32. Which of the following gives the value stored at the address pointed to by the pointer ptr?
ptr;
val(ptr);
*ptr;
&ptr;
Which of the following accesses a variable in structure b?
b->var;
b.var;
b-var;
b>var;
Which of the following accesses a variable in structure mystruct?
mystruct ->var;
mystruct.var;
mystruct -var;
mystruct >var;
Which of the following correctly accesses the seventh element stored in diana, an array with 100 elements?
diana[6]
diana[7]
diana(7)
diana;
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) AN (x < z))
The value 132.54 can represented using which data type?
Double
Void
Integer
Bool
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
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.
The difference between while structure and do structure for looping is
In while statement the condition is tested at the end of first iteration
In do structure the condition is tested at the beginning of first iteration
The do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not
In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop
A function that calls itself for its processing is known as
Inline Function
Nested Function
Overloaded Function
Recursive Function
The keyword endl
Ends the execution of program where it is written
Ends the output in cout statement
Ends the line in program. There can be no statements after endl
Ends current line and starts a new line in cout statement
42. Strings are character arrays. The last index of it contains the null-terminated character
\n
\t
\0
\1
Variables inside parenthesis of functions declarations have _____ level access
Local
Global
Module
Universal
44. Array indexing always starts with the number
0
1
-1
10
Which of the following accesses a variable in structure st1?
st1->var;
st1.var;
st1-var;
St1>var;
Which looping process is best used when the number of iterations is known?
For
While
Do-while
Nothing
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
parentheses ( )
Braces { }
Brackets [ ]
arrows < >
A memory address is…
where a variable is stored.
where a variable is defined.
where a variable is declares.
Where a variable is print out.
The set of instructions that a computer will follow is known as..
program
variable
Computer
brackets
cin >> number; is
an output statement
a colon
a variable
an input statement
cout << "How many items would you want?\n"; is
an output statement
a colon
a variable
an input statement
int number; is
an output statement
a variable declaration
a variable
an input statement
int number; is
an output statement
a variable declaration
a variable
an input statement
If x is 0, what is the value of (!x == 0)?
True
False
2
15
How to create array with n integers?
int n; cin >> n; int a = new# int[n];
int n; cin >> n; int& a; a = new int[n];
int n; cin >> n; int* a; a = new int[n];
int n; cin >> n; int a; a = new% int[n];
Which class should be included to work with files?
iostream
string
cmath
fstream
Which of the following is the valid array declaration
int num(5)
int mycat[5]
Array. double[5] marks
Myarray.counter int[5]
If the type specifies of parameters of a function is followed by an ampersand &, that function call is…
Pass by value
Pass by reference
All of answers
None of answers
Which of the following gives the memory address of a pointer pt1?
*pt1;
pt1;
&pt1;
address(ptr1);
Which libraries should be included to get string in a file?
<string> and <fstream>
<string> is enough
<fstream> is enough
<string> or <fstream>
There is given string named “str”. How to print in command line length of str?
cout << str.count();
cout << str.length;
cout << str.lenth();
cout >> str.lenth();
How to implement array of chars with 10 elements?
char* chs; chs = new char(10);
char chs; chs = char[10];
char chs[10];
char chs[] = new char[10];
103. How to implement array of integer numbers with n elements, and how to delete them correctly?
int n; cin >> n; int* a; a = new% int[n]; delete[] a;
int n; cin >> n; int& a; a = new int[n]; delete[] a;
int n; cin >> n; int* a; a = new@ int[n]; delete[n] a;
int n; cin >> n; int* a; a = new& int[n]; for(int i=0; i
How to get whole string in one line (in command line)?
string s; getline(cin, s);
string s; getline(cout, s);
string s; cin >> s;
string s; cout << s;
How to get whole string in one line (in file)?
ifstream file; string s; getline(file, s);
ifstream file; string s; getline(cin, s);
ifstream file; string s; getline(cout, s);
ifstream file; string s; file >> s;
Why do we need library <fstream>?
To work with strings.
To work with files.
To work with mathematical functionsю
To work with our own libraries.
Why do we need library <cmath>?
To work with strings.
To work with mathematical functions.
To work with command line.
To work with our own libraries.
Which of the following is the proper keyword to allocate memory?
new
malloc
create
value
112. Which of the following is the proper keyword to deallocate memory?
free
delete
clear
remove
Assume if A = 10; and B = 15; with using bitwise OR operator Find A||B
10
15
61
13
Find the operator
х
+
5+9*3*3-4>10&&(2+16-8/4>6||(2<6&&10>11))
True
False
Nothing
All of them
Assume if A=60;and B=13; with using bitwise OR operator.Find A||B
20
14
13
60
How many times the current loop will execute? For(int i=0;i<=5;i+=3);
3 times
2 times
Never
5 times
Infinite loop
118. There are two different ways to implement multi selections in C++ language. They are
Else if- and switch case
If…else and switch case
Else if
Not sure
A two-dimensional array represents data in the form of table with rows and columns
True
False
Nothing
All of them
Which statement of array is true?
Int foo[5]={10,20,30};
Int foo[]{10,20,30};
Int foo[3]={10,20,30};
Int foo[];
What are strings?
Strings are objects that represent sequences of characters
Strings are objects that represent sequences of pointers
Strings are objects that represent sequences of special words
Strings are objects that represent sequences of structures
In which data type we write text
String
Int
Float
Double
Choose the right syntax to define a function
name [parameter1, parameter2]
type (parameters)
parameter1, parameter2(name)
type name(parameter1, parameter2)
A function can return more than one value
True
false
the factorial function
if(n-1){return n*factorial(n-1);} else {return 1;}
n!=n*(n+1)!
n!=n-(n-1)! And 1!=1
n!=n/(n-1)! And 1!=1
which of the following are themselves a collection of different data types?
String
Structure
Char
Integer
Which of the following is address of operator represented by?
$
#
&
@
Pointers may be compared by using relational operators
True
False
What will be used between the object name and the member name?
Dot
Semicolon
Colon
Anything
Which of the following shows the correct syntax for an if statement?
If expression
If(expression)
If{expression}
Expression if
When does the code block following while(x<100)execute?
While it wishes
When x is less than one hundred
When x is greater than one hundred
When x is equal to one hundred
Which of the following properly declares struct?
Struct a_struct int a;
Struct a_struct {int a;};
Struct a_struct {int a;}
Struct {int a;}
Which of the following properly declares a variable of struct foo?
Struct foo;
Foo var;
Foo;
Int foo;
Which of the following correctly declares an array?
Int anarray[10];
Int anarray;
Anarray{10};
Array anarray[10];
What is difference between array and structure?
Only on their declaration
No difference
Structure can include members of different data types
Arrays can include only integers
Which of the following is the right declaration of the structure student:
struct Alua{};
struct student:Alua{}
struct student{string name;int age};
student.Alua{};
struct student=Alua{};
there is an array with 29 elements ,what is the index number of the last array
0
28
Array does not have element’s index
What character ends all strings?
‘,’
‘’
‘\0’
‘\n’
What is the index number of the last element of an array with 9 elements?
9
8
0
Nothing
What punctuation ends most lines of c++ code?
Dot
Semi-colon
Colon
Single quote
Which of the following identifiers(variable names)is invalid?
My*number
MyNumber
Mynumber
My7number
Which of the following is not a valid relational operator?
==
=>
>=
>=
When following piece of code is executed, what happens, if b=3;a=b++;?
A contains 3 and b contains 4
A contains 4 and b contains 4
A contains 4 and b contains 3
A contains 3 and b contains 3
Which of the following is output statement in c++?
Print
Write
Cout
Cin
. Which of the following is input statement in c++?
Cin
Input
Get
None of them
Which of the following is selection statement in c++?
Break
Goto
Exit
Switch
Which of the following is not a looping statement in c++?
While
Until
Do
For
Looping in a program means?
Jumping to the specified branch of program
Repeat the specified lines of code
None of above
Both of above
In case of pass by reference
The values of those variables are passed to the function so that it can manipulate them
The location of variable in memory is passed to the function so that it can use the same memory area for its processing
All of them
The function declaration should contain ampersand (& in its type declaration
.We declare a function with ________if it does not have any return type
Long
Double
Void
Int
Arguments of a functions are separated with
Comma(,)
Semicolon(;)
Colon
None of these
{"name":"Algoritmiz", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Welcome to the Algorithm Knowledge Quiz! This quiz is designed to test your understanding of algorithms, data structures, and programming concepts. Whether you are a student eager to enhance your skills or a seasoned programmer looking to refresh your knowledge, this quiz is for you!Multiple choice questions covering key topics.Assess your comprehension of logic, arrays, functions, and more.Challenge yourself and learn as you go!","img":"https:/images/course7.png"}
Powered by: Quiz Maker