Graded Quiz Unit 6

.docx
School
University of the People**We aren't endorsed by this school
Course
CS 4405
Subject
Computer Science
Date
Dec 27, 2024
Pages
10
Uploaded by BaronPencil15919
Graded Quiz Unit 6Started onTuesday, 24 December 2024, 9:42 AMStateFinishedCompleted onTuesday, 24 December 2024, 9:57 AMTime taken14 mins 59 secsMarks15.00/15.00Grade100.00 out of 100.00Question1CorrectMark 1.00 out of 1.00Flag questionQuestion textWhat will be the output of the following Swift code?struct Department {static var name: String = "Computer science"}let deptt = Department(name: "Mobile development")Question 1Answera.This code will give compile time errorb.Computer sciencec.Mobile Developmentd.NullFeedbackYour answer is correct.The correct answer is:This code will give compile time error
Background image
Question2CorrectMark 1.00 out of 1.00Flag questionQuestion textWhich of the following is the property of Swift sets?Question 2Answera.Elements are stored in a particular order.b.All the elements in a set must be unique.c.An element in a set can be accessed by its index.d.Sets contain items of numerical type only.FeedbackYour answer is correct.The correct answer is:All the elements in a set must be unique.Question3CorrectMark 1.00 out of 1.00Flag questionQuestion textWhat will be the output of the following Swift code snippet?var arr = [1,2,3,4]for element in arr {print(element, terminator: " ")}Question 3Answera.
Background image
1 2 3 4b.1,2,3,4c.[1 2 3 4]d.[1,2,3,4]FeedbackYour answer is correct.The correct answer is:1 2 3 4Question4CorrectMark 1.00 out of 1.00Flag questionQuestion textWhat does CRUD in database management stand for?Question 4Answera.Control, Run, Undo, Deleteb.Create, Run, Update, Deletec.Create, Read, Update, Destroyd.Create, Read, Update, DeleteFeedbackYour answer is correct.The correct answer is:Create, Read, Update, DeleteQuestion5Correct
Background image
Mark 1.00 out of 1.00Flag questionQuestion textA computed property (in Swift) having only a getter but NOT a setter is called read-only property.Question 5Select one:TrueFalseFeedbackThe correct answer is 'True'.Question6CorrectMark 1.00 out of 1.00Flag questionQuestion textWhich of the below options is a valid declaration for constants in Swift?Question 6Answera.var pi = 3.14b.pi = 3.14c.let pi = 3.14d.val pi = 3.14FeedbackYour answer is correct.The correct answer is:let pi = 3.14Question7CorrectMark 1.00 out of 1.00Flag questionQuestion text
Background image
Which of the following is the correct way of declaring a generic function in Kotlin?Question 7Answera.func <T> funcName(params: T)b.func funcName<T> (params: T)c.func {T} funcName(params: T)d.func [T] funcName(params: T)FeedbackYour answer is correct.The correct answer is:func <T> funcName(params: T)Question8CorrectMark 1.00 out of 1.00Flag questionQuestion textWhich of the following holds true for both swift classes and structs?Question 8Answera.Both the structs and class are of reference type.b.Conform protocols to provide standard functionality of a certain kind.c.Deinitialization - enables an instance to free up any resource assigned to it.d.Inheritance - enables one class or struct to inherit the characteristics of another.FeedbackYour answer is correct.
Background image
The correct answer is:Conform protocols to provide standard functionality of a certain kind.Question9CorrectMark 1.00 out of 1.00Flag questionQuestion textWhich of the following keywords is used for exception handling in Kotlin?Question 9Answera.triggerb.blockc.launchd.tryFeedbackYour answer is correct.The correct answer is:tryQuestion10CorrectMark 1.00 out of 1.00Flag questionQuestion textIn Kotlin, the catch block is used to catch the exception thrown by the try block.Question 10Select one:TrueFalseFeedbackThe correct answer is 'True'.Question11CorrectMark 1.00 out of 1.00
Background image
Flag questionQuestion textWhich Database, by default, is embedded in android?Question 11Answera.Oracleb.Core Datac.SQLited.MongoDBFeedbackYour answer is correct.The correct answer is:SQLiteQuestion12CorrectMark 1.00 out of 1.00Flag questionQuestion textYou can return multiple values from a swift function by using tuples as return types.Question 12Select one:TrueFalseFeedbackThe correct answer is 'True'.Question13CorrectMark 1.00 out of 1.00Flag questionQuestion textWhat will be the output of the below Swift code?
Background image
class Bird {var canFly: Bool?}var ostrich = Bird()let canFly = ostrich.canFly ?? falseprint(canFly)Question 13Answera.""b.falsec.Nulld.This code will not compileFeedbackYour answer is correct.The correct answer is:falseQuestion14CorrectMark 1.00 out of 1.00Flag questionQuestion textWhat will be the output of the following Kotlin code snippet?fun main() {val dividend = 6val divisor = 0var result: Inttry {result = dividend/divisor} catch (e : ArithmeticException){
Background image
println("Oops! You can’t divide a number by zero.")}}Question 14Answera.Oops! You can divide a number by zero.b.Oops! You can’t divide a number by zero.c.“Oops! You can’t divide a number by zero.”d.OOPS! You can’t divide a number by zero.FeedbackYour answer is correct.The correct answer is:Oops! You can’t divide a number by zero.Question15CorrectMark 1.00 out of 1.00Flag questionQuestion textHow many deinitializers can a swift class have?Question 15Answera.At most twob.At most onec.There should be no deinitializer at alld.At least two
Background image
FeedbackYour answer is correct.The correct answer is:At most one
Background image