Test
Big O notation and C++ pointers, arrays and strings
Este test tiene tiempo límite, así que se abre en el reproductor de siempre.
Preguntas del test (39)
1Show the representation of linear runtime algorithm with Big O notation
- AO (n log n)
- BThere is no correct answer
- CO (1)
- DO (n)
- EO (n^2)
2What for Big O notation is used?
- Ato write the pseudocode for an algorithm
- Bthere is no correct answer
- Cto estimate the worst-case runtime for an algorithm
- Dto change the iteration algorithm to recursive one
- Eto write the function
3Show the representation of exponential runtime algorithm with Big O notation
- AO (2)
- BO (log n)
- CO (n^2)
- DO (2^n)
- EThere is no correct answer
4What will be the output of cout << **suit, IF const char *suit[] = {"Hearts", "Diamonds", "Clubs", "Spades"};?
- ASome address
- BHeartsDiamondsClubsSpades
- CH
- DThere is no correct answer
- EHearts
5The smallest addressable unit of memory is
- Aa byte
- Ba bit
- Ca megabyte
- Da kilobyte
- EThere is no correct answer
6Show the representation of logarithmic runtime algorithm with Big O notation
- AO (n)
- BO (2^n)
- CThere is no correct answer
- DO (log n)
- EO (n^2)
7What happens if you try to compile and run this program?
int main() {
char s[10] = "ABCDE", * p = s + 2;
cout << p[1] - p[-1];
system("pause");
return 0;
}- Athe program outputs 1
- Bthe program outputs 2
- Cthe program outputs 3
- Dthe program outputs 4
- Ethe program outputs 5
8Show the representation of logarithmic linear runtime algorithm with Big O notation
- AO (2^n)
- BO (n^2)
- CO (n log n)
- DO (log 2)
- EThere is no correct answer
9What is the correct way of creating object of array container?
- Aarray<int, 5> arr;
- Barray<> arr;
- Carray<5> arr;
- Darray<int, string> arr;
- Earray<int> arr;
10What will be the output of cout << *(*(suit + 2) + 2), if const char *suit[] = {"Hearts", "Diamonds", "Clubs", "Spades"};
- Au
- Bi
- CSome address
- DDiamonds
- EClubs
11What will be the output of cout << *(*(suit+1)) if char *suit[] = {"Hearts", "Diamonds", "Clubs", "Spades"};
- Ab
- BH
- Ci
- DD
- Ee
12What happens if you try to compile and run this program?
void f(int i) {
i++;
}
int main(){
int i = 1;
f(i);
cout << i;
}- Athe program outputs 2
- Bthe program outputs 1
- Cthe program outputs 0
- Dthe program outputs 3
- Ethe program outputs an unpredictable value
13What is the worst-case runtime of linear search?
- AO (n)
- BThere is no correct answer
- CO (1)
- DO (n^2)
- EO (n^3)
14What will be the output of cout << suit[1][2];, if char *suit[] = {"Hearts", "Diamonds", "Clubs", "Spades"};?
- ADiamonds
- Be
- CSpades
- Da
- EHearts
15.______. are used to hold input from a data producer, such as a keyboard, a file, or a network.
- Ainput stream
- BThere is no correct answer
- Coutput stream
- Dfile stream
- Estring stream
16An aggregate data type is a type that groups multiple individual variables together. How we call that data type?
- Astructure
- Bvariable
- Cpointer
- Darray
- EThere is no correct answer
17Show the representation of quadratic runtime algorithm with Big O notation
- AO (n^3)
- BO (2^n)
- CThere is no correct answer
- DO (n)
- EO (n^2)
18What will be the output of int x[] = {7, 5, 6}; int *ptr = x; cout << *(ptr + 1);
- A7
- B5
- C6
- DSome address
- EThere is no correct answer
19What will be the output of cout << suit[3];, if char *suit[] = {"Hearts", "Diamonds", "Clubs", "Spades"};?
- AClubs
- BSpades
- CThere is no correct answer
- DSome address
- ENULL
20What is the library of following functions: strtok(), strstr()?
- Acstdlib
- Bcstring
- Cstring
- Dctime
- Ealgorithm
21If x is a variable name, how to assign its address to a pointer "ptr"?
- Aptr = x;
- Bptr = *x;
- C&ptr = *x;
- DThere is no correct answer
- Eptr = &x;
22A function that compares 2 strings.
- Astrcat();
- Bstrlen();
- Cstrcmp();
- Dstrtok();
- Estrcpy();
23What is recursive function?
- AIs a function that called itself
- BIs a function that doesn't return value
- CIs a function that has no parameters
- DIs a function that is called only once
- EThere is no correct answer
24A function that appends one string to another
- AThere is no correct answer
- Bstrcmp();
- Cstrlen();
- Dstrcat();
- Estrcpy();
25What operator you use to free the memory allocated dynamically?
- Aclear
- Bnew
- Cdelete
- DThere is no correct answer
- Eptr
26A ________ is a variable that holds a _________ as its value.
- Aaddress / array
- BThere is no correct answer
- Caddress / pointer
- Dpointer / memory address
- Earray / memory address
27What will be the output of cout << *suit, IF const char *suit[] = {"Hearts", "Diamonds", "Clubs", "Spades"};?
- ASome address
- BThere is no correct answer
- CHearts
- DHeartsDiamondsClubsSpades
- EH
28What operator do you use to allocate memory dynamcally?
- Anew
- Bdelete
- Cclear
- Dptr
- EThere is no correct answer
29What is the worst-case runtime of bubble sort?
- AO (n^2)
- BO (log n)
- CO (2^n)
- DO (n)
- EThere is no correct answer
30What will be the output of int x[] = {7, 5, 6}; cout << *(x + 2);
- A6
- BWill cause an error
- C7
- DThere is no correct answer
- E5
31Which class is used to deal with input streams
- Aistream
- Bostream
- Cfstream
- Dsstream
- Eastream
32A function that allows you to copy a string to another string.
- Astrcmp();
- Bstrlen();
- Cstrcat();
- Dstrcpy();
- EThere is no correct answer
33A variable is _____ , when pointer is _____.
- AThere is no correct answer
- Bindirect / direct reference
- Cdirect / direct reference
- Dindirect / indirect reference
- Edirect / indirect reference
34Choose the correct syntax for creating array dynamically
- Aint *a = new int[n];
- Bint a = new a[n];
- Cint &a = new int[a];
- Dint *new = a int[n];
- Eint a = delete a;
35You have a function
void print(int x, int y = 5, int z = 10) {
cout << x << " " << y << " " << z;
}
What is the output of function call print(5, 1);?- A5 1 10
- B5 1 1
- C1 5 5
- D5 5 10
- E1 5 10
36What is the size of pointer in 32-bit systems?
- A8 bytes
- BThere is no correct answer
- C2 bytes
- D1 byte
- E4 bytes
37What is the correct syntax to declare a pointer?
- Atype *&pointer_name;
- BThere is no correct answer;
- Ctype pointer_name;
- Dtype *pointer_name;
- Etype &pointer_name;
38Choose functions for unformatted input and output with streams.
- Aread(), listen(), write(), print(), see();
- Bwrite(), take(), place(), put(), read();
- Cgetline(), get(), put(), read(), write();
- Dwrite(), put(), get(), take(), give();
- Eput(), take(), input(), output(), show();
39What happens if you try to compile and run this program?
int main() {
char s[10] = "ABCDE", * p = s + 3;
cout << p[1] - p[-1];
system("pause");
return 0;
}- Athe program outputs 5;
- Bthe program outputs 4;
- Cthe program outputs 3;
- Dthe program outputs 2;
- Ethe program outputs 1;
Información
- Descripción
- Test sobre Sin título, creado por Tamerlan Sandykbaev el 11/06/2019.
- Autor
- Tamerlan Sandykbaev
- Idioma
- English
- Visitas
- 7
- Valoración
- Aún sin valoraciones Valora este test