Delphi Level Test Paper (preliminary and intermediate) Example
I. multiple choice questions (40 questions in total)
1. You must switch back and forth between the form and editor windows frequently during program development. You can use the shortcut key ().
A, F12, and F11
B, F12, and f13
C, F12, and CTRL + F12
D, F12, ALT + F12
E, F12, and shift + F12
2. A function is as follows:
Function check (n, k: integer): integer;
VaR M: integer;
Begin
Repeat
M: = n mod 10;
N: = N Div 10;
K: = K-1
Until K = 0;
Check: = m
End;
If the call statement Y: = check (3725,3) is used, the value y after running is :()
A, 7 B, 5 C, 2 D, 0
3. The following component cannot be edited by user input ()
A. tedit
B. tcombobox
C. tmaskedit
D. tlabel
E. tstringgrid
4. An object class can inherit and directly use all the members of its parent class, :()
A. Public Domain
B. Private domain
C. Protected and private domains
D. protected domain and Method
E. Private domains and Methods
5. Delph does not use the following file types ().
A. FRM
B. Pas
C. DFM
D. DPR
E,. Res
6. the shape component is located on the () component board.
A. Standard
B. Additional
C. Data Controls
D. System
E. Samples
7. the query component does not have the () attribute like the table component.
A. datasource
B. tablename
C. Filtered
D. Database
E. updateobject
8. Which of the following statements about attributes is true ().
A. attributes can implement the write method.
B. attribute can implement the read Method
C. attributes can be read-only or write-only
D. attributes can be public or non-public.
E. Attributes cannot be directly accessed.
9. When debugging the program, you need to execute the source code line of the execution point and stay in the next source code line. You can use the () menu item.
A. Run
B. Step over
C. Trace
D. Trace to next source line
E. Run to cursor
10. Set a to a Boolean variable and other to an integer variable. The correct value assignment statement below is ()
A, x = y Div 7
B, X: = Y: = z + 1
C, A: = x = y mod z
D, X + Y: = z
E, x + y =
11. The value of the expression round (4.2) mod trunc (2.8) is ()
A, 0
B, 1
C, 2
D, 3
E, 4
12. Which of the following constant definitions is valid ()
A. Const width = 7;
B. Const case = '7 ';
C. Const 1A = 7.9;
D. Const century = year Div 100;
E. Const 5 <> 7;
13. Which of the following operators has the highest priority ()
A, +
B, or
C.> =
D. Div
E ,-
14. If we know that A, B, C, and D are simple variables of the same type and have different values, run the following statement:
B: = A; A: = C; D: = A; D: = B; the variable with the same value is ()
A, a, c
B, A, D
C, C, B
D, B,
E. uncertain
15. It is known that VaR X: real; the error in the following section is :()
Case x <=2.0
0: X: = 0;
1: X: = 1
End
A. Constant in the case expression
B. The case constants and case expressions are of different types.
C. The types of the assignment statement are inconsistent.
D. The case expression is a relational expression.
E. The case syntax is not standard.
16. The number of cycles for the following statements is ()
X: = 37; Y: = 3
While Y <= x do Y: = Y + Y
A, 3
B, 4
C, 5
D, 6
E, 0
17. Program for I: = 1 to 5 do
For J: = 2 to I do
Writeln ('*');
The number of output '*' is ()
A, 5
B, 10
C, 15
D, 25
E, 30
18. Which of the following function headers is valid ()
A. Function total (X: Real );
B. Procedure AB (A, B: Real): real;
C. Procedure sum;
D. function f (var f: Real): integer;
E. Procedure fontlistboxkeydown (Sender: tobject; var key: word;
Shift: tshiftstate ;);
19. Known functions are as follows:
Function f (N: integer): integer;
Begin
If n = 0 then F: = 0
Else if n> 0 then F: = f (n-2)
Else F: = f (N + 3)
End;
The value of calling F (5) is ()
A, 0
B, 1
C.-1
D.-2
E, 2
20. Which of the following types is valid ()
A, type A = 10... 10;
B. Type B = 10 .. 5;
C, type C = 0 .. SQRT (10 );
D, type D = 10. 0 .. 20.0;
E, Type E = random (9) .. 1
21. Among the following types of variables, the variables that cannot be directly output using the write language are ()
A. boolean variables
B. Enumeration Variables
C. Integer Variables
D. Balanced Variables
E. Long Integer variable
22. If Y is a collection variable and X is of the same type as Y, which of the following statements is false ()
A. [x] In Y
B. Y-[x]
C. [x] + [] * y
D, Y <= [x]
E, y MOD [x]
23. The domain identifier of a record cannot be the same as the following ()
A. Constant identifier
B. Record Name
C. Class Name
D. Same-layer domain identifier
E. Domain identifiers of different layers
24. Known var A: array ['A'... 'e', 1 .. 4, Boolean] of real;
The number of elements in array a is ()
A, 5
B, 20
C, 40
D, 11
E, 22
25. Known var A: array [1 .. 10] of integer;
K, I: integer;
Program Section:
K: = 1;
For I: = 1 to 10 do
If a [I]> A [k] Then
K: = I;
Writeln (A [k]);
After execution, the output is ()
A. Average Value in the array
B. Maximum Value in the array
C. Minimum value in the array
D. sum in the array
E. uncertain
26. If var F: file of integer is known, F indicates ()
A. ASCII code file
B. binary files
C. Text Files
D. text files that store Integers
E. html files
27. In VCL, () is the parent class of tdblistbox.
A. tcustomlistbox
B. tlistbox
C. tdbdataset
D. tdatabase
E. tdbedit
28. The () attribute of the control is required to display the text in the pop-up prompt box for the control.
A. Handle
B. Hint
C. showhint
D. Showing
E. Visible
29. The event that occurs when the left-click control is ()
A. onmousedown
B. onmouseup
C. onclick
D. ondbclick
E. onenter
30. Which of the following values is not the possible values of the formstyle attribute ()
A. fsnormal
B. fsmidchild
C. fsmidform
D. fsstayontop
E. fsdesktop
31. () is a file management subroutine included in Delphi
A, append, and insert
B. append and mkdir
C. fileclose and insert
D. mkdir and insert
E, getdir, and insert
32. () is a DDE-related group
A. ddeserverconv/ddeclientconv/ddeserveritem/ddeclientitem
B. ddeserver/ddeclient
C. ddeconv/ddeitem
D. ddeconv/ddeserveritem
E. ddeserver/ddeclient/ddeserveritem/ddeclientitem
33. advantages of using Delphi multithreading ()
A. Faster program running
B. synchronous access to shared resources and memory is not required
C. Easier Programming
D. The thread can be run in the background.
E. No windows errors
34. There are multiple ways to place objects in the OLE document receiver, excluding ()
A. embed an object using a specific menu command
B. paste an object from the clipboard to create a new embedded object
C. paste the link object from the clipboard to create a new embedded object.
D. Create a new object in the file generated by the server.
E. Passing objects through the ODBC interface
35. keywords used for exception handling do not include ()
A. Try
B. t
C. Finally
D. Raise
E. Error
36. Which of the following statements is false ()
A. The VCL component is the most effective and useful component of Delphi.
B. com is the foundation of Ole and ActiveX.
C. COM objects can be used in any windows programming environment
D. The VCL component is a COM object.
E. Typical COM objects are included in files with the extension. dll or. ocx.
37. The default value of the style attribute of the tcombobox component is ()
A. csdropdown
B. cssimple
C. csdropdownlist
D. csownerdrawvariable
E. csownerdrawfixed
38. objects created on the "new" tab of the Object Library "new item" include ()
A. Package, DLLs, component, web server application
B. Package, COM Object, component, and web server application
C, package, DLLs, component, and about box
D. Package, DLLs, component, DB Web Application Wizard
E, package, DLLs, component, mid Application
39. In Delphi, the data type with a value range of 0 to 255 is ()
A. Random int
B. byte
C. smallint
D. Real
E, word
40. Which of the following statements about the event is false ()
A. You do not have to respond to all events defined by a component.
B. Multiple components can share the same event handler.
C. Respond to events of any component as needed
D. Click the event handler name in the object Inspector. The Code Editor automatically enters the code segment of the event.
E. The sender parameter of the event is used to determine which component generates the event.
2. No questions (20 in total)
1. Select the project | syntax check menu option from the main menu. Delphi will compile any unit modified after the previous compilation and report the encountered error. ()
2. Some VCL objects of Delphi are pointers, and some are not allocated space from the stack. ()
3. When pasting, if the component used as the container has been selected, the component in the clipboard will be pasted as a sub-component of the container component ()
4. Adding any code to the form class declaration section managed by Delphi will cause a program error. ()
5. Delphi can use more than one detail area in a report ()
6. Delphi can use traditional resources like other development tools. For example, menus can be loaded as resources to facilitate the implementation of multi-language environments. ()
7. When creating a component, you can define the default value of the property, but the string property cannot have the default value. ()
8. After a constant is declared, the value of this constant cannot be changed in the program. ()
9. The constructor must be activated through a valid instance of the class. ()
10. In the design phase, the object Inspector displays all attributes of the selected component. ()
11. In Delphi IDE, hold down the Shift key and click the component icon on components palette to place multiple similar components in the form. ()
12. To reduce programming errors, you can use the system function isvalidident provided by Delphi to check whether the string is valid. ()
13. If the user does not add any code in a complete event response process, the process will be automatically cleared when the project is saved or compiled. ()
14. the runtime packages technology can be used to separate the original standalone executable files into dynamic linked libraries and add small executable files, the advantage of this is that the disk space is smaller than an independent executable file. ()
15. Similarly, Delphi and VB cannot generate real executable code (Local Code), but the program developed by Delphi runs faster than VB. ()
16. The attributes of most components can be changed at runtime, and some of them can only be changed at runtime. ()
17. The properties of the forms and their components created in your Delphi project are stored in an independent description file, that is, a file with the DSK extension. ()
18. The find error command in the search menu is used to find running errors, rather than compile errors. ()
19. The enabled attribute is not applicable to non-visual components. ()
20. Delphi adopts the object-based reference mode, that is, every variable of the class does not save the object value, but stores a reference or a pointer to indicate the memory location of the Object Storage. ()
3. correct questions (4 questions in total)
1. Identify the following code errors and explain the causes:
VaR
I: integer;
L: long;
Begin
L: = 32768;
I: = L;
End.
2. Identify the following code errors and explain the causes:
If N & gt; 37.5 then
Amountearned: = (n-37.5) * hourlyrate * 1.5 + 37.5 * hourlyrate;
Else
Amountearned: = N * hourlyrate;
3. Identify the following code errors and explain the causes:
While (total <max) and (sum <= max) and (sum <total)
Do statement1;
4. Identify the following code errors and explain the causes:
Procedure tform1.testbtnclick (Sender: tobject );
VaR Z, Y, X: integer;
Begin
X: = 100;
Y: = 0;
Try
Z: = x Div y;
Except
On edivbyzero
Do Z: =-1;
Messagedlg ('Z' + inttostr (z), mtinformation, [mbok], 0)
End;
4. Q & A (3 in total)
1. What is the difference between a dialog box and a subwindow in Delphi?
2. What are the purposes of using private domains and methods?
3. When ActiveX is working on a webpage, it always gets an error from Inernet explorer. Error: "Your current settings prohibit ActiveX controls ". What is the error?
5. programming questions (2 in total)
1. calculate and output the sum of the top 10 prime numbers in all prime numbers (I .e. prime numbers) between 300 and 500 K and the number J of all prime numbers between 300 and 500, and output the result to the file mydata. dat.
2. write code in the tform1.formactive event, which requires a loop to be included and draw lines consecutively with different colors at random positions on the screen.
6. Design Questions (1 in all)
Design a practical Windows Font selection list window. Requirements:
1) You can select a font in the list box (tlistbox ).
2) You can adjust the font size in the tspinedit box.
3) The font and size are displayed in WYSIWYG mode.