BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

CIW Exam 1D0-735 Topic 10 Question 70 Discussion

Actual exam question for CIW's 1D0-735 exam
Question #: 70
Topic #: 10
[All 1D0-735 Questions]

Consider this source code:

Giam needs to write a script to access the first element in the source code. What code should he use?

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Yuonne
1 months ago
Hold up, guys. Shouldn't we be using 'document.querySelector' instead of all this 'getElementById' and 'getElementsByTagName' nonsense? That's the modern way to do it, you know.
upvoted 0 times
Brandon
16 days ago
C) var first = document.querySelector('#condiments');
upvoted 0 times
...
Barney
20 days ago
B) var first = document.querySelector('#input');
upvoted 0 times
...
Annita
22 days ago
A) var first = document.querySelector('#condiments1');
upvoted 0 times
...
...
Fidelia
1 months ago
Okay, let me get this straight. We need to access the first element, not the second one. So option A is just plain wrong. C is clearly the correct answer here.
upvoted 0 times
Brice
15 days ago
I agree, option C is the way to go to access the first element.
upvoted 0 times
...
An
17 days ago
Yeah, option A is definitely wrong because it's trying to access the second element.
upvoted 0 times
...
Roslyn
29 days ago
I think you're right, option C is the correct answer.
upvoted 0 times
...
...
Patti
2 months ago
Hmm, I'm a bit confused. Shouldn't we be using the 'getElementsByTagName' method instead of 'getElementById'? I think option D is the way to go.
upvoted 0 times
Ettie
12 days ago
User1: Maybe we should reconsider our options.
upvoted 0 times
...
Chaya
14 days ago
User3: I agree with User2, option D seems incorrect.
upvoted 0 times
...
German
24 days ago
But wouldn't we use getElementsByTagName instead of getElementById?
upvoted 0 times
...
Chaya
29 days ago
I think option D is correct.
upvoted 0 times
...
...
Gearldine
2 months ago
Option B looks good to me. Accessing the element with the ID 'input' should give us the first input element in the source code.
upvoted 0 times
Thora
30 days ago
Let's go with option B then. It seems like the most logical choice.
upvoted 0 times
...
Chaya
1 months ago
I agree, using document.getElementById('input') should work.
upvoted 0 times
...
Vinnie
1 months ago
I think option B is correct. It should access the first input element.
upvoted 0 times
...
...
Miss
2 months ago
I'm pretty sure the correct answer is C. The code needs to access the first element with the ID 'condiments', and that's exactly what the option C code does.
upvoted 0 times
Quiana
1 months ago
Yes, option C is the right choice to access the first element with the ID 'condiments'.
upvoted 0 times
...
Ariel
1 months ago
That makes sense, option C is using the correct method to access the first element.
upvoted 0 times
...
Gwen
2 months ago
I agree, option C is accessing the element with the ID 'condiments' at index 0.
upvoted 0 times
...
Latricia
2 months ago
I think you're right, option C looks like the correct code to access the first element.
upvoted 0 times
...
...
Providencia
2 months ago
Why do you think it's A?
upvoted 0 times
...
Bea
2 months ago
I disagree, I believe the answer is A.
upvoted 0 times
...
Providencia
2 months ago
I think the answer is C.
upvoted 0 times
...

Save Cancel