MCQs > IT & Programming > Delphi MCQs > Basic Delphi MCQs

Basic Delphi MCQ

1.

 This question is based upon the figure shown below
 


From the code shown, how many times would the ShowMessage procedure be called if the button in question was clicked three (3) times?

 

Answer

Correct Answer: 2

Note: This Question is unanswered, help us to find answer for this one

2.

Which of the following retrieves the value from the SNumber field as a string for the current record in an open Table called Table1?

Answer

Correct Answer: Table1.FieldByName('SNumber').AsString;

Note: This Question is unanswered, help us to find answer for this one

3.

Which of the following is the correct code to cause a popup menu named Popupmenu1 on a form called Form1 to be displayed?

Answer

Correct Answer: Application.DisplayMenu(Form1.Popupmenu1);

Note: This Question is unanswered, help us to find answer for this one

4.

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?

Answer

Correct Answer: PageControl1.TabIndex:=1;

Note: This Question is unanswered, help us to find answer for this one

5.

Which key toggles between the Object Inspector and the Edit Window / Form?

Answer

Correct Answer: F11

Note: This Question is unanswered, help us to find answer for this one

6.

What is the purpose of the Initialization section of a Unit?

Answer

Correct Answer: It contains statements that are executed on unit start up

Note: This Question is unanswered, help us to find answer for this one

7.

What is the purpose of the AlphaBlend property of TForm?

Answer

Correct Answer: It specifies if the form is translucent or not

Note: This Question is unanswered, help us to find answer for this one

8.

What is the purpose of the TDataModule?

Answer

Correct Answer: To provide a location for centralized handling of non-visual components

Note: This Question is unanswered, help us to find answer for this one

9.

What does the procedure shown do?

Answer

Correct Answer: It copies the contents of the file c:\autoexec.bat to the file c:\outfile.txt

Note: This Question is unanswered, help us to find answer for this one

10.

What is the purpose of Code Templates?

Answer

Correct Answer: To provide easy access to commonly used programming statements

Note: This Question is unanswered, help us to find answer for this one

11.

Which of the following properties when set to True, enables an application to gain sole access to a database?

Answer

Correct Answer: TDatabase.Exclusive

Note: This Question is unanswered, help us to find answer for this one

12.

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?

Answer

Correct Answer: ComboBox1.Items.Add(Edit1.Text);

Note: This Question is unanswered, help us to find answer for this one

13.

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?

Answer

Correct Answer: Property: Interval, Measured in: Milliseconds (1/1000 Sec)

Note: This Question is unanswered, help us to find answer for this one

14.

What is the shortcut key for manually displaying the code completion window while entering code?

Answer

Correct Answer: CTRL + SPACE

Note: This Question is unanswered, help us to find answer for this one

15.

What is the purpose of the AutoMerge property in the TMainMenu component?

Answer

Correct Answer: It determines if main menus of secondary forms merge with the main menu of the main form in non-MDI applications at runtime

Note: This Question is unanswered, help us to find answer for this one

16.

When will the code "Application.Terminate;" be executed in the code shown?

Answer

Correct Answer: When the user presses the Ok button

Note: This Question is unanswered, help us to find answer for this one

17.

Which of the following is NOT an event of the TApplicationEvents component?

Answer

Correct Answer: OnBusy

Note: This Question is unanswered, help us to find answer for this one

18.

Which of the following removes the SQL statement from a TQuery component called Query1?

Answer

Correct Answer: Query1.SQL.Clear;

Note: This Question is unanswered, help us to find answer for this one

19.

In the code shown, TMyClass inherits from which parent class?

Answer

Correct Answer: TObject

Note: This Question is unanswered, help us to find answer for this one

20.

What does the TDBLookupComboBox component do?

Answer

Correct Answer: It performs a search for a field with the same name as the text entered

Note: This Question is unanswered, help us to find answer for this one

21.

Which of the following is the correct code to "tick" a TCheckBox component called CheckBox1 as shown?

Answer

Correct Answer: CheckBox1.Checked:=True;

Note: This Question is unanswered, help us to find answer for this one

22.

Which of the following is the correct code to cause a form named Form1 to be displayed as modal?

Answer

Correct Answer: Form1.ShowModal;

Note: This Question is unanswered, help us to find answer for this one

23.

Which of the following would cause all the items in a RadioGroup to be appended so that all items appear twice?

Answer

Correct Answer: Radiogroup1.Items.AddStrings(Radiogroup1.Items);

Note: This Question is unanswered, help us to find answer for this one

24.

What is the purpose of the Alignment Palette?

Answer

Correct Answer: To align components to the form, or with each other

Note: This Question is unanswered, help us to find answer for this one

25.

What value is displayed on screen when the procedure test is called?

Answer

Correct Answer: 13

Note: This Question is unanswered, help us to find answer for this one

26.

Which of the following changes a TDBNavigator component called DBNavigator1 so that it only displays navigation buttons?

Answer

Correct Answer: DBNavigator1.VisibleButtons := [nbFirst,nbLast,nbPrior,nbNext];

Note: This Question is unanswered, help us to find answer for this one

27.

What is the main difference between TLabel and TStaticText?

Answer

Correct Answer: TStaticText has a Window Handle and can accept focus whereas TLabel does not have a Window Handle and cannot accept focus

Note: This Question is unanswered, help us to find answer for this one

28.

What files end with the .dpk extension?

Answer

Correct Answer: Package Source files

Note: This Question is unanswered, help us to find answer for this one

29.

Which of the following is the correct code to create an object from class TMainForm?

Answer

Correct Answer: Application.CreateForm(TMainForm, MainForm);

Note: This Question is unanswered, help us to find answer for this one

30.

Which of the following is the correct method to activate a modal open dialog box when using the TOpenDialog component?

Answer

Correct Answer: OpenDialog1.Execute;

Note: This Question is unanswered, help us to find answer for this one

31.

How does a TRichEdit differ from a TMemo?

Answer

Correct Answer: TRichEdit allows font attributes to be set, whereas TMemo does not

Note: This Question is unanswered, help us to find answer for this one

32.

Given that x and y are variables declared as type Char, which of the following is NOT a valid Pascal assignment statement?

Answer

Correct Answer: x := y + #22;

Note: This Question is unanswered, help us to find answer for this one

33.

What happens if the TreeView1.Items list is empty when the code "TreeView1.Items.AddFirst(TreeView1.Items[0],'X');" is executed?

Answer

Correct Answer: An ETreeViewError exception is raised with the message 'Invalid Index'

Note: This Question is unanswered, help us to find answer for this one

34.

Which three properties of TProgressBar are responsible for setting the minimum, maximum and current position for the control?

Answer

Correct Answer: Max, Min & Position

Note: This Question is unanswered, help us to find answer for this one

35.

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?

Answer

Correct Answer: GetLongHint(Application.Hint);

Note: This Question is unanswered, help us to find answer for this one

36.

Which of the following is a event of TPanel?

Answer

Correct Answer: OnExit

Note: This Question is unanswered, help us to find answer for this one

37.

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?

Answer

Correct Answer: DataSource1.DataSet:=Table1;

Note: This Question is unanswered, help us to find answer for this one

38.

What is the value of the variable int_temp after the for loop has ended in the code shown?

Answer

Correct Answer: 1

Note: This Question is unanswered, help us to find answer for this one

39.

Which property of TBitBtn allows you to specify what image to display on the button?

Answer

Correct Answer: BitBtn1.Glyph

Note: This Question is unanswered, help us to find answer for this one

40.

What does the Cancel property of the TButton object do?

Answer

Correct Answer: It determines if the button's OnClick event handler is called when the Escape key <Esc> is pressed on the keyboard

Note: This Question is unanswered, help us to find answer for this one

41.

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?

Answer

Correct Answer: Query1.Active:=True;

Note: This Question is unanswered, help us to find answer for this one

42.

What is the purpose of the "Break" procedure?

Answer

Correct Answer: It causes the flow of control to exit a loop and continue at the next statement following the loop

Note: This Question is unanswered, help us to find answer for this one

43.

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?

Answer

Correct Answer: UpDown1.Associate := Edit1;

Note: This Question is unanswered, help us to find answer for this one

44.

What component is used to link two datasets in a master/detail relationship?

Answer

Correct Answer: TDataSource

Note: This Question is unanswered, help us to find answer for this one

45.

Which of the following will add text to a TMemo component called Memo1?

Answer

Correct Answer: Memo1.Lines.Add('Text');

Note: This Question is unanswered, help us to find answer for this one

46.

TDataSet is a base class from which other database components are inherited to encapsulate which database object(s)?

Answer

Correct Answer: A Query

Note: This Question is unanswered, help us to find answer for this one

47.

Which of the following are valid identifier names for a variable?

Answer

Correct Answer: Cust_no5

Note: This Question is unanswered, help us to find answer for this one

48.

Which of the following are the valid DeviceType property values for the TMediaPlayer component?

Answer

Correct Answer: dtAutoSelect

Note: This Question is unanswered, help us to find answer for this one