Quiz 2 Flashcards

1
Q
What should be the data type of fact?
void main() {
\_\_\_\_\_\_\_ fact = 1;
for (int i = 1; i <= 20; i++) { 
fact *= i;  }

a) int
b) long
c) long long
d) int*

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is NOT true about l-value?

a) It refers to a memory location

b) It is a data value stored at some address in
the memory

c) A value can be assigned to it

d) It can appear at both the left and the right
hand side of an assignment

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following is/are compound data type(s)?

a) String
b) Array
c) Pointer
d) Short
e) B and C above
f) A, B and C above

A

f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
What is the value of x after this code is run?
int x = 10;
int * y = &amp;x;
int z = *y;
z = 20; 
*y = 30;

a) 10
b) 20
c) 30
d) undefined

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of these is not a type of memory allocation in C++?

a) Static
b) Const
c) Dynamic
d) Automatic

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following assignments is valid?

a) char foo[] = “Hello”;
b) foo = “Hi!”;
c) foo[] = “Hello”;
d) foo[i] = “Hi!”;
e) A and D above

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly