Upwork/oDesk Delphi 6 Test Answers
·
1. Which of the following are the
valid DeviceType property values for the TMediaPlayer component?
Answers:
• dtAutoSelect
• dtMP3
•
dtExternalDevice
• dtAudio
• dtTV
• dtMPEG3
• dtDAT
• dtDigitalVideo
2. Which of the following are valid
identifier names for a variable?
Answers:
• Cust_no5
• Cust no5
• 5Cust_No
• cUSTNo
• custno 5
• cust&no
3. TDataSet is a base class from which
other database components are inherited to encapsulate which database
object(s)?
Answers:
• A Table
• A Trigger
• A Field
• A Query
• A DBAware
Component
• A Stored Procedure
4. Which of the following will add
text to a TMemo component called Memo1?
Answers:
• Memo1.Lines.Add('Text');
•
Memo1.AddLine('Text');
•
Memo1.Lines.Include('Text');
•
Memo1.Lines.Append('Text');
5. How does a TRichEdit differ from a
TMemo?
Answers:
• TRichEdit
prevents users from overwriting existing text, whereas TMemo does not
• TRichEdit
allows saving directly to text files, whereas TMemo does not
• TRichEdit
prevents font attributes from being changed by the user, whereas TMemo does not
• TRichEdit allows font
attributes to be set, whereas TMemo does not
6. In the code shown, TMyClass
inherits from which parent class?
Answers:
• TApplication
• TObject
• Inheritance
does not take place
• TMyClass
7. What component is used to link two
datasets in a master/detail relationship?
Answers:
• TTable
• TDataSource
• TMasterDetail
• TDatabase
8. Which of the following is a event
of TPanel?
Answers:
• OnClose
• OnExit
• OnTerminate
• OnDoubleClick
9. Given the code "Edit1.Hint :=
'Customer Name|Enter Customer Name in the edit box';", which of the
following is the correct code to retrieve the text after the | character, i.e.
"Enter Customer Name in the edit box", when the OnHint handler is
called?
Answers:
• GetLongHint(Application.Hint);
•
GetHint(Application.Hint);
•
GetShortHint(Application.Hint);
•
GetSecondHint(Application.Hint);
10. Given that x and y are variables
declared as type Char, which of the following is NOT a valid Pascal assignment
statement?
Answers:
• x := y;
• x :=
Char(Ord(Y)+1);
• x := Char(#22);
• x := y + #22;
11. Which of the following changes a
TDBNavigator component called DBNavigator1 so that it only displays navigation
buttons?
Answers:
•
DBNavigator1.VisibleButtons := [nbFirst,nbLast,nbPrior,nbNext];
•
DBNavigator1.NavigationOnly := True;
•
DBNavigator1.Buttons := [nbFirst,nbLast,nbPrior,nbNext];
•
DBNavigator1.Constraints := [nbFirst,nbLast,nbPrior,nbNext];
12. Which of the following is the
correct code to "tick" a TCheckBox component called CheckBox1 as
shown?
Answers:
• CheckBox1.Checked:=True;
•
CheckBox1.Ticked:=True;
•
CheckBox1.Tick(True);
•
CheckBox1.Enabled:=True;
13. Which of the following is NOT an
event of the TApplicationEvents component?
Answers:
• OnActionExecute
• OnBusy
• OnMessage
• OnHint
• OnException
• OnSettingChange
14. The TTimer component has a
property which determines how frequently the OnTimer event occurs. Which
of the following is that property and what does the property measure?
Answers:
• Property: Time,
Measured in: Seconds
• Property:
Timer, Measured in: Hundreds of a second (1/100 Sec)
• Property: Interval,
Measured in: Milliseconds (1/1000 Sec)
• Property: Tick,
Measured in: Clock Ticks
15. Which of the following will link a
TUpDown control named UpDown1 with an Edit box named Edit1, allowing the
TUpDown control to modify the values in the Edit box?
Answers:
• UpDown1.Associate :=
Edit1;
• UpDown1.Link :=
Edit1;
•
UpDown1.Link(Edit1);
•
Link(UpDown1,Edit1);
16. What is the purpose of the
"Break" procedure?
Answers:
• It causes the
flow of control to exit the current function or procedure and execute the next
logical code statement
• It causes the
current thread to suspend execution to allow other threads to operate
• It simulates
the user pressing the Break key on the keyboard
• It causes the flow of
control to exit a loop and continue at the next statement following the loop
17. For a TQuery component called
Query1 with SQL of "Select * from Student Where Number=500", which of
the following is the correct method to run the query?
Answers:
• Query1.Active:=True;
• Query1.RunSQL;
•
Query1.ExecuteAction(SQL);
• Query1.ExecSQL;
18. What does the Cancel property of
the TButton object do?
Answers:
• It
automatically displays Cancel as the button caption
• It determines if the
button's OnClick event handler is called when the Escape key <Esc> is
pressed on the keyboard
• It calls the
parent forms' OnClose event
• It causes a
popup menu to be displayed when the button is clicked which permits the user to
select Cancel
19. Which property of TBitBtn allows
you to specify what image to display on the button?
Answers:
•
BitBtn1.CaptionImage
• BitBtn1.Image
• BitBtn1.Glyph
• BitBtn1.Picture
20. What is the value of the variable
int_temp after the for loop has ended in the code shown?
Answers:
• 1
• 2
• 5
• The value of
int_temp is undefined
21. Which of the following will
connect a DataSource to a Table where the Datasource component is call
DataSource1 and the Table component is called Table1?
Answers:
•
DataSource1.Table:=Table1;
•
DataSource1.DataSet:=Table1;
•
DataSource1.Source:=Table1;
•
DataSource1.SetTable(Table1);
22. Which three properties of
TProgressBar are responsible for setting the minimum, maximum and current
position for the control?
Answers:
• Maximum,
Minimum & Percentage
• Maximum,
Minimum & Position
• Max, Min & Position
• Max, Min &
Pos
23. What does the code shown do?
Answers:
• Creates an
array to store two Integers
• Creates an
array to store two Variants
• Creates an array to store
one hundred Integers
• Creates an
array to store ninety nine Integers
24. What happens if the
TreeView1.Items list is empty when the code
"TreeView1.Items.AddFirst(TreeView1.Items[0],'X');" is executed?
Answers:
• An X appears as
the top most node in the TreeView
• An "Index
is out of bounds" error message is displayed
• An ETreeViewError
exception is raised with the message 'Invalid Index'
• An X appears as
a sub node to the first node in the TreeView
25. Given a TPageControl component
called PageControl1 with three TabSheets called TabSheet1, TabSheet2 and
TabSheet3 (in that order), which of the following will make TabSheet2 selected?
Answers:
• PageControl1.TabIndex:=1;
• TabSheet2.Show;
•
PageControl1.ShowTab(TabSheet2);
•
PageControl1.VisibleTab:=TabSheet2;
•
TabSheet2.Click;
•
TabSheet2.Select(PageControl1);
26. Which of the following is the
correct code to cause a popup menu named Popupmenu1 on a form called Form1 to
be displayed?
Answers:
•
Application.DisplayMenu(Form1.Popupmenu1);
•
Form1.Popupmenu1.Popup(20,30);
•
Form1.Popupmenu1.ShowMenu;
•
Form1.ShowMenu(Popupmenu1);
27. Which of the following is the
correct method to activate a modal open dialog box when using the TOpenDialog
component?
Answers:
•
OpenDialog1.OpenFile;
•
OpenDialog1.GetFile;
•
OpenDialog1.Filename;
• OpenDialog1.Execute;
28. Which of the following is the
correct code to create an object from class TMainForm?
Answers:
•
Form.Create(TMainForm);
•
Application.CreateForm(TMainForm, MainForm);
•
TMainForm.CreateForm(MainForm);
• MainForm:=Application.CreateFormInstance(TMainForm);
29. What files end with the .dpk
extension?
Answers:
• Unit Source
files
• Project Source
files
• Package Source files
• Delphi Library
30. What is the main difference
between TLabel and TStaticText?
Answers:
• TStaticText has a Window
Handle and can accept focus whereas TLabel does not have a Window Handle and
cannot accept focus
• TStaticText
allows the user to edit the text displayed whereas TLabel does not allow the
user to edit the text displayed
• TLabel's
caption property can be changed programmatically whereas TStaticText's Caption
property cannot be changed programmatically
• TLabel does not
have a ShowAccelChar property whereas TStaticText does have a ShowAccelChar
property
31. Which of the following retrieves
the value from the SNumber field as a string for the current record in an open
Table called Table1?
Answers:
•
Table1.Field.SNumber.AsString;
•
String(Table1.Fields('SNumber'));
•
Table1.FieldByName('SNumber').AsString;
•
Table1.Items.String('SNumber');
32. What value is displayed on screen
when the procedure test is called?
Answers:
• 5
• 13
• 8
• 3
33. What is the purpose of the
Alignment Palette?
Answers:
• To change the
order or position of the components in the Visual Component Library
• To align the
main IDE Windows to each other
• To align components to the
form, or with each other
• To set the
alignment property of any components on a form
34. Which of the following would cause
all the items in a RadioGroup to be appended so that all items appear twice?
Answers:
•
Radiogroup1.Items.Duplicate;
•
Radiogroup1.Append(Radiogroup1);
•
Radiogroup1.Items.Append(rgALL);
•
Radiogroup1.Items.AddStrings(Radiogroup1.Items);
35. Which of the following is the
correct code to cause a form named Form1 to be displayed as modal?
Answers:
• Form1.Show;
•
ShowModal(Form1);
•
Form1.ModalResult:=mrOk
• Form1.ShowModal;
36. What does the TDBLookupComboBox
component do?
Answers:
• It allows a
field value to be selected from a TList object specified by the programmer
• It performs a search for a
field with the same name as the text entered
• It allows the
selection of a database from a list of those found on a network
• It identifies a
set of field values in one dataset with a corresponding set of values from another
dataset
37. From the code shown, how many
times would the ShowMessage procedure be called if the button in question was
clicked three (3) times?
Answers:
• 0
• 1
• 2
• 3
38. Which of the following removes the
SQL statement from a TQuery component called Query1?
Answers:
•
Query1.SQL.Delete;
•
Query1.Delete(SQL);
• Query1.SQL.Clear;
•
Query1.Enabled:=False;
39. What does the code shown do?
Answers:
• Loads the number 1 into
the DH register
• Loads the
number 1 into the dh variable
• Loads the
character '1' into the dh variable
• Loads the value
in the dh variable into the DH register
40. When will the code
"Application.Terminate;" be executed in the code shown?
Answers:
• When the user
presses the Cancel button
• Every time the
procedure is executed
• When the user presses the
Ok button
• Never
41. What is the purpose of the
AutoMerge property in the TMainMenu component?
Answers:
• It determines if main
menus of secondary forms merge with the main menu of the main form in non-MDI
applications at runtime
• It determines
if sub menu items are automatically merged with the parent menu items if there
is only a single sub menu item
• It determines
if the main menu items can be automatically resized at runtime so that they
provide a "best fit" in a resizable form
• It determines
if the TMainMenu component can correct menu item short cut key conflicts with
existing Windows short cut keys
42. What is the shortcut key for
manually displaying the code completion window while entering code?
Answers:
• CTRL + SPACE
• CTRL + ESC
• CTRL + ALT +
TAB
• CTRL + Page
Down
43. Given a ComboBox named ComboBox1
and an Edit box named Edit1, which of the following is the correct code to add
the information in the Edit box to the drop down list in the ComboBox?
Answers:
•
ComboBox1.Items.Add(Edit1.Text);
•
ComboBox1.Strings := ComboBox1.Strings + Edit1.Text;
•
ComboBox1.List.AddItem(Edit1.Text);
•
ComboBox1.Append(Edit1.Text);
44. Which of the following properties
when set to True, enables an application to gain sole access to a database?
Answers:
•
TDatabase.OthersReadOnly
• TDatabase.KeepConnection
•
TDatabase.Params
• TDatabase.Exclusive
45. What is the purpose of Code
Templates?
Answers:
• To provide easy access to
commonly used programming statements
• To allow the
creation of Document Templates from existing source code
• To provide easy
access to Native Databases without using components
• To allow the
conversion of selected code to a procedure
46. What does the procedure shown do?
Answers:
• It moves the
contents of the file c:\autoexec.bat to the file c:\outfile.txt
• It moves the
contents of the file c:\outfile.txt to the file c:\autoexec.bat
• It copies the contents of
the file c:\autoexec.bat to the file c:\outfile.txt
• It copies the
contents of the file c:\outfile.txt to the file c:\autoexec.bat
47. What is the purpose of the
TDataModule?
Answers:
• To provide a
login to a secured or an encrypted database
• To provide a
temporary storage area of query results
• To provide a location for
centralized handling of non-visual components
• To provide a connection
to a remote database server
48. What is the purpose of the
AlphaBlend property of TForm?
Answers:
• It specifies
the background color of the form
• It specifies if the form
is translucent or not
• It specifies if
the form is available for drawing on via TCanvas
• It specifies
the redrawing speed of the form
49. What is the purpose of the
Initialization section of a Unit?
Answers:
• It contains
assembly code that is executed on PC startup
• It contains statements
that are executed on unit start up
• It contains
Window handling code
• It contains
program management code and should not be edited directly by a programmer
50. Which key toggles between the
Object Inspector and the Edit Window / Form?
Answers:
• ALT + O
• F11
• F4
• CTRL + ALT +
TAB