MCQs > IT & Programming > Swift > Output when the file doesn’t exist? import UIKit let filename:String = 'testfile'; var readdata:String = 'test data';

Swift MCQs

Consider the following code output when the file doesn’t exist?

import UIKit

 let filename:String = "testfile";

var readdata:String = "test data";

 let pathname = NSURL(fileURLWithPath: "..") URLByAppendingPathComponent(filename) ;

do {

             readdata = try NSString(contentsOfURL: pathname, encoding:NSUTF8StringEncoding)            as String } catch { print("read error")

}

print(readdata);

Answer

Correct Answer: test data

Explanation:

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

Swift Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Swift Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it