I don't know if the answer is correct. Further improvement in the future.
First, C + + Foundation
Choice and fill in the blanks
1. vc++6.0 environment, assume that A is an integer (int) array name, then the address of element A[8] is: C
A. a+4 b.a+8 c.a+16 d.a+32
2. Define "int a=3, b=4, c=5;", then the value of "C <= (A + b) && b! = C" is () 1
3. char* name = "Victor Hugo";
then sizeof (name) = (4), sizeof (*name) = (1).
4. int* p = NULL; Occurs when delete p (D)
A. Stack corruption B. Memory leaks
C. normal Operation D. Program interruption
5. A Class A is defined and has a statement a * pa=new a (5); So the following statement is correct: a
A. The statement creates an object of Class A and assigns the address of the object to the pointer pa;
B. The statement creates 5 objects of Class A, and their addresses are contiguous;
C. When the pointer variable PA is outside its scope, the PA and the space allocated for the object are automatically freed;
D. There must be an explicitly defined constructor and an explicitly defined virtual destructor in Class A;
6. In a class, which of the following members can be multiple? D
A. Parameterless constructor B. destructor
C. Prototype the same non-static member functions D. Static member functions
7. When creating a derived class object with a member object, the order of execution for each constructor body is: C
A. Derived class member object class base class B. member object class base class derived class
C. Base class member object class derived class D. base class derived class member object class
8. When defining the non-static member function of Class A a&f (a& one), a statement returnexp is required; exp cannot be: B
A. Static data member of type A in Class A B. F with Statement A = one; Defined amount A
C. One D. *this
9. In the following keywords, cannot be used to indicate that the inheritance method is: B
A. Private B. Static C. Public D. protected
10. About virtual void Draw () = 0; The following statement is incorrect (C)
A. It is a pure virtual function
B. It cannot be implemented in the class in which it is defined
C. If a class inherits the class that defines it, you must implement all of the pure virtual functions in it
D. The class that defines it is not instantiated
11 a variable definition int i, J; The expression i==0 && j==0 equivalent to the expression is: (B)
(A) i| | J (B)!i&&!j (C)!i==!j (D) i==j
12. Set the variable int a = 5; Which of the following expressions evaluates to make the value of variable B equal to 2? A
(A) B=A/2 (b) b=6-(a--) (C) b=a%2 (D) b=a>3?3:2
13. Known int x=1, y=0; After executing the following program segment, the value of Y is (C).
if (x) {if (x>0) Y=1;} else y=-1;
(A)-1 (B) 0 (C) 1 (D) uncertainty
14. The following is not able to determine whether the string s is empty string is (D)
(A) if (s[0]==0) (B) if (strlen (S) ==0)
(C) if (strcmp (S, "") ==0) (D) if (s== ')
(b) Char x[5]={' A ', ' B ', ' \ s ', ' C ', ' \ '} output of the string.
(a) ' a ' ' B ' (b) AB (c) ab C (D) ABC
16. In the narrative of the new and delete operations below, the erroneous statement is (C).
(A) The memory space allocated by new is contiguous
(B) If the current memory does not have enough space to allocate, the new operator returns null
(C) Memory space allocated by the new operator, which is automatically retracted at the end of the function execution
(D) storage space occupied by static arrays in a program cannot be freed by using delete
17. There are definitions:
struct data
{
int i;
Char ch;
Double q;
Double F
}b;
In cases where memory alignment is not considered, the number of bytes that the struct variable B occupies in memory is (D)
(A) (B) (C) (D) 21
18. The X class is known. Then when the program executes to the statement, X Array[3], the (D) secondary constructor is called.
A) 0 B) 1 C) 2 D) 3
19. In the following description of the derived class, the error is (D).
A) a derived class can act as a base class for another derived class
B) A derived class has at least one base class
C) A member of a derived class, in addition to its own member, contains the members of its base class
D) The access rights of the base class members inherited from the derived class remain unchanged to the derived class
20. Under the description of the static data member, the correct one is (B).
A) static data members can be initialized in the body of the class
B) static data members can be called directly with the class name
C) static data members cannot be affected by the private control
D) static data members cannot be called by objects of the class
Second, data structure
1. Set x=0011 0110 (binary), if you want to use the x&y operation so that the low 4 bits in X are not changed, the high 4 bits are zeroed, then the following can achieve this function is (B)
(A) x=x|0x0f (B) x=x&0x0f (C) x=x|0xf0 (D) x=x&0xf0
2. In a single-linked list HL with a head node, to insert a node that is pointed to by the pointer p to the table header, execute (B).
A. p->next=hl->next; hl->next=p; B. p->next=hl; Hl=p;
C. p->next=hl; P=HL; D. hl=p; p->next=hl;
3. The input sequence is 1, 2, 3, 4, 5, 6, the output sequence that can be obtained after the function of the stack is (B).
(A) 5,3,4,6,1,2 (B) 3,2,5,6,4,1
(C) 3,1,2,5,4,6 (D) 1,5,4,6,2,3
4. The most common operation in setting up a linked list is to insert or delete elements at the end of the list, and the following (B) storage is the most efficient time to use.
(A) Unidirectional link list (B) one-way circular link list
(C) bidirectional linked list (D) bidirectional cyclic link list
5. The element in the ordered table is (13,18,24,35,47,50,62), in which the binary method of finding the element with a value of 24 requires a (C) comparison.
(A) 1 (B) 2 (C) 3 (D) 4
6. If the sequential table has a length of n, the average comparison number of sequential lookups is (C).
(A) n (B) N/2 (C) (n+1)/2 (D) (n-1)/2
7. In a tree with a degree of 3, the number of nodes with a degree of 3 is 2, the number of nodes with 2 degrees is 1, the number of nodes with 1 is 2, and the number of nodes with degrees 0 is (C).
(A) 4 (B) 5 (C) 6 (D) 7
8. A queue is a linear table of (a).
(A) FIFO (B) Advanced post-exit (C) only insert (D) can only be removed
9. Set e={(A, B), (A,e), (A,c), (B,e), (E,d), (d,f), (F,c)}, a vertex sequence that can be obtained from vertex a for depth-first traversal is (a).
(A) AEDFCB (B) acfebd (C) aebcfd (D) AEDFBC
10. If there are n vertices in a non-direction graph, then there are (B) table header nodes in the adjacency table of the non-direction graph.
(A) 2n (B) n (C) N/2 (D) n (n-1)
11. If there are n vertices in a strong connected graph, there is at least (C) edge in the strong connected graph.
(A) n (n-1) (B) n+1 (C) n (D) n (n+1)
12. If the input sequence of a stack is 1 2 3, then the output sequence of the stack may not be in the following sequence (C)
A.2 3 1 B.3 2 1
C.3 1 2 D.1 2 3
13. In a sparse matrix linked store with a row pointer vector, each node in the single-linked list has the same (a).
A Line number B. Column number C. Element value D. Number of non-0 elements
14. Which of the following data structures is a non-linear structure? D
A. Queue B. stack C. Linear table D. Two fork Tree
15. The insert and delete operations of the stack are performed at (A).
A stack top B bottom C Any position D specify position
Third, Windows
1. For the 32-bit Windows under handle (handle), the following is incorrect: C
A handle is a 4-byte long integer value
B handles are used to identify different instances of different objects or homogeneous objects in the application
C message is one of the handles
The handle type of the D brush is hpen, and the handle type of the brush is Hbrush
E Don't know
2. In the basic application framework of a Windows API, there is the following message loop:
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&MSG);
DispatchMessage (&MSG);
}
Which of the following messages causes the message loop to exit from running, thus terminating the entire application run: B
A Wm_destroy
B Wm_quit
C Wm_close
D wm_create
E Don't know
3. In the case of Windows API Programming window functions (WNDPROC), it is incorrect to say: D
A It is a callback function
B its internal Switch...case branch determines the handling of different types of messages
C It has four entry parameters, meaning the same as message structure MSG
D If you use full-empty window functions (no code inside), Windows will also be responsible for processing messages by default
The 4.Windows window corresponds to the refresh request, and the following scenarios do not require application considerations: D
A, refresh after the window is moved
B, refresh of the covered area
C, when scrolling through the window with the scroll bar
D, when the icon or cursor crosses the window
E, I don't know.
5. The following statement about the image pattern in Windows drawing is incorrect: D
A, the default image mode is Mm_text
B, only in mm_anisotropic mode, the x, Y axis scale may not be 1:1
C, in all image modes, by default the coordinates of the upper left corner of the window are (0,0)
In D,mm_himetric mode, the x-axis is in the right direction and the y-axis is in the positive direction
E, I don't know.
6. The following statement about the keyboard response of Windows applications is correct: D
A, the keyboard scan code is not dependent on the specific device
B,windows application does not use messages to handle keyboard responses
C, press a key on the keyboard, it is not possible to generate both key messages and character messages
The TranslateMessage function in the message loop of the D,winmain function is used to convert the keystroke message to a character message
7. The following statement about the mouse response to the Windows application is correct: B
A, only the active window can accept mouse events
B, you can call the function setcapture () to achieve the mouse capture, and capture the mouse system after the keyboard function temporarily invalid
C, the user can only invoke a system-defined mouse cursor shape and cannot customize the cursor
D, you can respond to a mouse drag event by a corresponding single type of mouse message
E, I don't know.
8. In the application framework of Windows API development, which of the following methods cannot load a menu: D
A, when defining the window class, set the lpszmenuname of the structure wndclass to the appropriate dish sole name
B, when creating the window, call LoadMenu first to get the menu handle, and then call the function CreateWindow load the menu
C, call LoadMenu in application to get menu handle, Invoke function SetMenu load menu dynamically
D, in the window processing function, set the appropriate message response for the menu message
E, I don't know.
9. In the following APIs, it is possible to post messages to a window without waiting for the window to be processed and return: a
A.sendmessage
B.postmessage
C.sendthreadmessage
D.postthreadmessage
E. I don't know.
10. The following APIs can be used to open the device handle: a
A.createfile
B.openprocess
C.openclipboard
D.openmutex
E. I don't know.
Four, MFC
1. The function that can get the pointer to the document object in CView is ( GetDocument
)
2. CDialog class inherits from (CWnd) class
3. In the CListBox class, the member function that gets the index of the user-selected string is (GetCurSel)
4. In the CDialog class, the member function that obtains a pointer to a child control with the specified ID is (GetDlgItem)
In a 5.CString class, a member function that can find a character or substring in a larger string is (find)
6.MFC, the global function used to create a new thread is (AfxBeginThread)
7. An interface that all COM components must implement is ( IUnknown
)
In 8.MFC, classes derived from the (CCmdTarget) class can have a message map.
9. A COM component, if you want to support automation, the interface that must be implemented is (IDispatch)
10. MFC-based Win32 executables have and have only one object that derives from the (CWINAPP) class of an application class that represents the application itself.
11.MFC, the corresponding class of the text box is CEdit, then the corresponding class of the toolbar is (CScrollBar)
12.MFC, a button is known to be a pointer cbutton* p; Then set this button to gray disabled state can call function (EnableWindow)
13. The message to redraw the window is (WM_PAINT)
V. Advanced Programming/Other
1. To assign a value to the absolute address 0x100000, we can use * (int*) 0x100000 = 1234;
So if you want the program to jump to the absolute address 0x100000 to execute, what should be done? Please write the code
* ((Void (*) ()) 0x100000) (); Jump with function pointer
2. It is known that the 0x64 is the data port of the keyboard, and when a key on the keyboard is pressed, it can be read from the data port to the scan code of the pressed key. A programmer in the VS2008 MFC dialog box under the program to write the following code, trying to get the keyboard input information, but he failed, ask why this is? How to solve?
#include <conio.h>
......
BYTE Readdatafromkeyboard ()
{
RETURN_INP (0x64);
}
3. For a byte (8bit) of data, the number of bits "1", which requires the algorithm to perform as high as possible.
4. Exchange values for int variables A and B, requiring no temporary variables.
5. Please write down the bubble sorting algorithm. The function signature is void Sort (int pdata[],int Count);
6. Which of the following C + + reference books is the thickest?
A. "Think in C + +" B. "MFC in Layman's"
C. "C + + Primer" D. "Effective C + +"
A set of Windows/mfc face questions