Tải bản đầy đủ (.doc) (5 trang)

Đề thi về C++

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (36.49 KB, 5 trang )

C++
Question #1
Q What number of digits that can be accuratly stored in a float (based on the
IEEE Standard 754)?
a) 6
b) 38
c) An unlimited number
Answer: A
Question #2
Q Which of the following is evaluated first:
a) &&
b) ||
c) !
Answer: C
Question #3
Q What does 7/9*9 equal (in C and C++)?
a) 1
b) 0.08642
c) 0
Answer: C
Question #4
Q Which is not valid in C?
a) class aClass{public:int x;};
b) /* A comment */
c) char x=12;
Answer: A
Question #5
Q Which of the following is not a valid declaration for main()?
a) int main()
b) int main(int argc, char *argv[])
c) They both work


Answer: C
Question #6
Q Evaluate as true or false: !(1 &&0 || !1)
a) True
b) False
c) Invalid statement
Answer: A
Question #7
Q Which command properly allocates memory?
a) char *a=new char[20];
b) char a=new char[20];
c) char a=new char(20.0);
Answer: A
Question #8
Q What operator is used to access a struct through a pointer?
a) ->
b) >>
c) *
Answer: C
Question #9
Q Which is not an ANSII C++ function?
a) sin()
b) kbhit()
c) tmpnam()
Answer: B
Question #10
Q True or false, if you keep incrementing a variable, it will become negative?
a) True
b) False
c) It depends...

Answer: C
Question #11
Q What character terminates all character array strings
a) \0
b) .
c) \END
Answer: A
Question #12
Q If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops
out first?
a) 5
b) 1
c) 3
Answer: A
Question #13
Q What does strcat(an_array, "This"); do?
a) Copies "This" into an_array
b) Adds "This" to the end of an_array
c) Compares an_array and "This"
Answer: B
Question #14
Q Evaluate:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;

}
for fn(7);
a) 10
b) 11
c) 1
Answer: B
Question #15
Q Evalute the following: 22%5
a) 2
b) 4
c) 0
Answer: A
Question #16
Q Which of the following data structures is on average the fastest for
retrieving data?
a) Binary Tree
b) Hash Table
c) Stack
Answer: B
Question #17
Q What is the output:
int v()
{
int m=0;
return m++;
}
int main()
{
cout<<v();
}

a) 1
b) 0
c) Program is illegal
Answer: B
Question #18
Q What does cout<<(0==0) print out?
a) 0
b) 1
c) Compiler error: Lvalue required
Answer: B
Question #19
Q What is the maximum value of a unsigned char?
a) 255
b) 256
c) 128
Answer: A
Question #20
Q Evaluate !(1&&1||1&&0)
a) Error
b) True
c) False
Answer: C

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×