Swift - Variables and ConstantsWhich of the following Swift declarations uses explicit type annotation correctly?Avar name: String = "John"Bvar name String = "John"Cvar name = String: "John"Dvar name = "John": StringCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify correct syntax for explicit type annotationIt requires a colon after the variable name, then the type, then an equal sign and value.Step 2: Evaluate each optionOnly var name: String = "John" matches this pattern correctly.Final Answer:var name: String = "John" -> Option AQuick Check:Explicit type annotation syntax = var name: Type = value [OK]Quick Trick: Colon after variable name before type [OK]Common Mistakes:Missing colon between name and typePlacing type after valueUsing colon after value
Master "Variables and Constants" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Collections - Array operations (append, insert, remove) - Quiz 6medium Data Types - Tuples for grouped values - Quiz 11easy Functions - Argument labels and parameter names - Quiz 13medium Loops - Stride for custom step - Quiz 10hard Loops - For-in loop with collections - Quiz 4medium Loops - Break and continue behavior - Quiz 10hard Operators and Expressions - Nil coalescing operator deep usage - Quiz 14medium Optionals - Optional binding with if let - Quiz 4medium Optionals - Optional binding with if let - Quiz 8hard Variables and Constants - Why let and var distinction matters - Quiz 13medium