Bonjour,
Je suis en train de me lancer dans VBA (jen ai besoin dans un cadre professionnel en finance...). J'ai lu quelques cours dessus et j'ai fait un quiz pour le premier chapitre mais dont je ne dispose pas de la correction, donc je voulais savoir si qn qui s'y connaissait bien pouvait m'aider en me disant si mes réponses sont les bonnes (si c'est faux pliz me donner la bonne réponse)
Merci d'avance,
Cordialement,
Jean-Christophe,
le test se trouve ci-dessous, mes réponses sont les suivantes : 1E / 2C / 3E / 4C / 5 A / 6A / 7B / 8E
Question 1:
Which of the following is NOT an object declaration
Choose one answer. a. Dim x as Workbook
b. Dim x as Worksheet
c. Dim x as Integer
d. Dim x as Range
e. Dim x as Float
Question 2
Marks: 1 A variable "MyVar" is defined in the declaration region of Module 2 as follows:
Dim MyVar as Double
Which of the following statements is most correct?
Choose one answer. a. MyVar can be used in any procedure within any Module within the current workbook
b. MyVar can be used in any procedure within Module 1 but not Module 2
c. MyVar can be used in any procedure within Module 2 but not Module 1
d. MyVar can be used in any procedure within Module 2 and any module with a number higher than 2 in the current workbook
Question 3
Marks: 1 Consider the following expression:
switch(MyTest, MyVal1, True, MyVal2)
Which of the following remarks about it is True?
Choose one answer. a. it is exactly equivalent to iif(MyTest = MyVal2, MyVal1, True)
b. it is exactly equivalent to iif(MyTest = MyVal1, MyVal2, True)
c. it is exactly equivalent to iif(MyTest, MyVal1, MyVal2)
d. it is exactly equivalent to iif(MyTest, MyVal2, MyVal1)
e. it is exactly equivalent to iif(MyTest = MyVal1, True, MyVal2)
Question 4
Marks: 1 The following lines of code are typed directly into the Immediate Window. What are the values of X and Y printed by the Print statements?
X = 10
Y = 25
' Swap Values
X = Y
Y = X
Print "X is " & X & ", and Y is " & Y
Choose one answer. a. X is 10, and Y is 25
b. X is 25, and Y is 25
c. X is 25, and Y is 10
d. X is 10, and Y is 10
e. None of the above, there is a syntax error in the Debug.Print statement
Question 5
Marks: 1 A variable MyVar is defined within a procedure called MyProc in a module called "Module 1".
Dim MyVar as Integer
Which of the following is most correct?
Choose one answer. a. MyVar can be used within loops and branches within MyProc but nowhere else
b. MyVar can be used anywhere within Module 1, but not outside the module
c. MyVar can be used within the procedure MyProc but no where else
d. MyVar can be used within the spreadsheet, but no where else
Question 6
Marks: 1 What is the value printed by the following code fragment?
Sub test()
Dim i As Integer
i = 4.2 / 2
Debug.Print i
End Sub
Choose one answer. a. Runtime Error
b. Syntax Error
c. 2.1
d. 2
e. 2.0
Question 7
Marks: 1 Which of the following statements is most correct?
Choose one answer. a. Arrays are fixed sized arrays, and can be changed with a ReDim statement
b. Arrays are fixed sized arrays, and the size can be decreased with a ReDim statement, but not increased
c. Arrays are fixed size vectors and the size can never be changed
d. Arrays are fixed sized arrays, and the size can be increased with a ReDim statement, but not decreased
e. Arrays are fixed sized arrays, and can be changed with a ReDim statement as long as the dimensionality remains unchanged
Question 8
Marks: 1 Which of the following answers best describes the error in the following code fragment.
Dim x as Range
x = Range("A1").offset(0, 0)
Choose one answer. a. Range should be replaced by Application.ActiveSheeet.Range
b. the variable x needs to be declared as an array
c. It is illegal to access the 0th element of a range
d. The assignment requires a set instead of a variable assignment
e. Range should be replaced by Application.Sheets(0).Range
Partager