Deck 2: C++ Function and Array

ملء الشاشة (f)
exit full mode
سؤال
When arguments are passed by value, the function works with the original arguments in the calling program.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which of the following can legitimately be passed to a function?

A)a constant
B)a variable
C)a structure
D)all of the above
سؤال
How many values can be returned from a function?

A)0
B)1
C)2
D)3
سؤال
When a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable.
سؤال
When an argument is passed by reference

A)a variable is created in the function to hold the argument's value.
B)the function cannot access the argument's value.
C)a temporary variable is created in the calling program to hold the argument's value.
D)the function accesses the argument's original value in the calling program.
سؤال
Overloaded functions

A)are a group of functions with the same name.
B)all have the same number and types of arguments.
C)make life simpler for programmers.
D)a and c
سؤال
A static local variable is used to

A)make a variable visible to several functions.
B)make a variable visible to only one function.
C)retain a value when a function is not executing.
D)b and c
سؤال
In C++ there can be an array of four dimensions.
سؤال
When an array name is passed to a function, the function

A)accesses exactly the same array as the calling program.
B)refers to the array using a different name than that used by the calling program.
C)refers to the array using the same name as that used by the calling program.
D)a and b
سؤال
The compiler will complain if you try to access array element 14 in a 10-element array.
سؤال
The extraction operator (>>) stops reading a string when it encounters a space.
سؤال
You can read input that consists of multiple lines of text using

A)the normal cout <<combination.
B)the cin.get() function with one argument.
C)the cin.get() function with two arguments.
D)the cin.get() function with three arguments.
سؤال
You should prefer C-strings to the Standard C++ string class in new programs.
سؤال
Objects of the string class

A)are zero-terminated.
B)can be copied with the assignment operator.
C)do not require memory management.
D)both b and c
سؤال
Can destuctors be private in C++?
سؤال
What is value of size?

A)28
B)32
C)20
D)24
سؤال
What value will be printed for data.i?

A)10 220.5 230.5 unpredictable value
B)220
C)230.5
D)unpredictable value
سؤال
What is the compilation error for this program?

A)each undeclared identifier is reported only once
B)cout and cin not declared in scope
C)invalid conversion from int to float
D)all of the above
سؤال
What will be the output of the program?

A)1
B)default value
C)will not compile
D)none of the above
سؤال
What is the output of the program?

A)0 0
B)x = 0 y = 0
C)0
D)compilation error
سؤال
Which function will change the state of the object?

A)only set()
B)only display()
C)display() and set() both
D)none of the above
سؤال
What will be the output of the following program?

A)compilation error: display() cannot be accessed in application
B)compilation error:test class object cannot be accessed in function demo
C)compilation error: variable x is private in test
D)both a and b
سؤال
The only integer that can be assigned directly to a pointer is                    

A)0
B)-1
C)999
D)-999
سؤال
Which of the following feature is not supported by C++?

A)exception handling
B)reflection
C)operator overloading
D)namespace
سؤال
The operators that cannot be overloaded is

A)*
B)-
C)::
D)()
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/25
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 2: C++ Function and Array
1
When arguments are passed by value, the function works with the original arguments in the calling program.
False
2
Which of the following can legitimately be passed to a function?

A)a constant
B)a variable
C)a structure
D)all of the above
all of the above
3
How many values can be returned from a function?

A)0
B)1
C)2
D)3
1
4
When a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
5
When an argument is passed by reference

A)a variable is created in the function to hold the argument's value.
B)the function cannot access the argument's value.
C)a temporary variable is created in the calling program to hold the argument's value.
D)the function accesses the argument's original value in the calling program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
6
Overloaded functions

A)are a group of functions with the same name.
B)all have the same number and types of arguments.
C)make life simpler for programmers.
D)a and c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
7
A static local variable is used to

A)make a variable visible to several functions.
B)make a variable visible to only one function.
C)retain a value when a function is not executing.
D)b and c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
8
In C++ there can be an array of four dimensions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
9
When an array name is passed to a function, the function

A)accesses exactly the same array as the calling program.
B)refers to the array using a different name than that used by the calling program.
C)refers to the array using the same name as that used by the calling program.
D)a and b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
10
The compiler will complain if you try to access array element 14 in a 10-element array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
11
The extraction operator (>>) stops reading a string when it encounters a space.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
12
You can read input that consists of multiple lines of text using

A)the normal cout <<combination.
B)the cin.get() function with one argument.
C)the cin.get() function with two arguments.
D)the cin.get() function with three arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
13
You should prefer C-strings to the Standard C++ string class in new programs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
14
Objects of the string class

A)are zero-terminated.
B)can be copied with the assignment operator.
C)do not require memory management.
D)both b and c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
15
Can destuctors be private in C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
16
What is value of size?

A)28
B)32
C)20
D)24
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
17
What value will be printed for data.i?

A)10 220.5 230.5 unpredictable value
B)220
C)230.5
D)unpredictable value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
18
What is the compilation error for this program?

A)each undeclared identifier is reported only once
B)cout and cin not declared in scope
C)invalid conversion from int to float
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
19
What will be the output of the program?

A)1
B)default value
C)will not compile
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
20
What is the output of the program?

A)0 0
B)x = 0 y = 0
C)0
D)compilation error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which function will change the state of the object?

A)only set()
B)only display()
C)display() and set() both
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
22
What will be the output of the following program?

A)compilation error: display() cannot be accessed in application
B)compilation error:test class object cannot be accessed in function demo
C)compilation error: variable x is private in test
D)both a and b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
23
The only integer that can be assigned directly to a pointer is                    

A)0
B)-1
C)999
D)-999
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following feature is not supported by C++?

A)exception handling
B)reflection
C)operator overloading
D)namespace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
25
The operators that cannot be overloaded is

A)*
B)-
C)::
D)()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.