[Déplacé .Net --> VBA] Aide quiz VBA - Débutant en galère

doggyfissal Messages postés 3 Date d'inscription vendredi 11 juillet 2008 Statut Membre Dernière intervention 3 novembre 2009 - 3 nov. 2009 à 15:06
userrrqi115 Messages postés 181 Date d'inscription mardi 18 novembre 2008 Statut Membre Dernière intervention 4 février 2011 - 6 nov. 2009 à 11:49
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,

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

6 réponses

doggyfissal Messages postés 3 Date d'inscription vendredi 11 juillet 2008 Statut Membre Dernière intervention 3 novembre 2009
3 nov. 2009 à 15:20
HELP PLIIIz!!!
0
bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 15
3 nov. 2009 à 16:17
Salut,

je ne te donne pas les reponses si erreur il y a mais juste OK ou NOK

1) NOK
2) OK
3) NOK
4) NOK
5) NOK
6) NOK
7) NOK
8) NOK

une seule réponse de bonne

A+
0
bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 15
3 nov. 2009 à 16:23
ooups pas bien lu la premiere

erratum

2 réponses de bonnes

1) OK
2) OK
3) NOK
4) NOK
5) NOK
6) NOK
7) NOK
8) NOK

A+
0
bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 15
3 nov. 2009 à 16:35
re

un petit doute quand même le float statement n'existe pas en vba 6.3

je ne sais pas sur quel VBA s'appui ton cours mais ce type existe bel et bien dans d'autre langage comme le C/C++ mais n'est, il me semble, pas de type object !?!

integer n'étant pas non plus un type object la question me parait maintenant bien male posée !

A+
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
doggyfissal Messages postés 3 Date d'inscription vendredi 11 juillet 2008 Statut Membre Dernière intervention 3 novembre 2009
3 nov. 2009 à 16:56
Serait-il possible svp de m'indiquer les réponses justes dans ce cas là, car j'ai beau relire mon livre je ne vois pas trop en quoi c'est faux ???

Merci d'avance,

Jean-Christophe,
0
userrrqi115 Messages postés 181 Date d'inscription mardi 18 novembre 2008 Statut Membre Dernière intervention 4 février 2011
6 nov. 2009 à 11:49
Hello,
Pour la 4, il faut penser que le code s'exécute ligne par ligne.
Pour avoir la réponse à la 6, pourquoi ne pas tester de ton côté.
Continuons dans les chiffres pairs, la 8, test sheets(0).select

Les questions imapairs sont trop longues à lire, je passe la main.
Sinon peux-tu nous donner l'ouvrage que tu as en ta possession ?
BR

USERRRQI115
Simple user
Great brain
0
Rejoignez-nous