如何使用Flutter中的单选按钮将此json称为测验格式

问题描述 投票:0回答:1

这是JSON文件。

[
 {
   "Question": "The syntax of printf() function is printf(“control string, variable list) ;what is the prototype of the control string?",
   "Option1": "a) %[flags][.precision][width][length]specifier",
   "Option2": "b) %[flags][length][width][.precision]specifier",
   "Option3": "c) %[flags][width][.precision][length]specifier",
   "Option4": "d) %[flags][.precision][length][width]specifier",
   "Answer": " c",
   "Explaination": "Explanation: The prototype of control string is %[flags][width][.precision][length]specifier. Each control string must begin with % sign."
 },
 {
   "Question": "The parameter control string in the printf () is a C String that contains text to be __________",
   "Option1": "a) taken from a standard output device",
   "Option2": "b) written on to the standard output device",
   "Option3": "c) received from the standard output device",
   "Option4": "d) nothing can be said",
   "Answer": " b",
   "Explaination": "Explanation: After the control string, the function can have many additional arguments as specified in the control string, this parameter contains the text to be written on to the standard output device."
 },
 {
   "Question": "Output justification such as decimal point, numerical sign, trailing zeros or octal are specified.",
   "Option1": "a) specifier",
   "Option2": "b) flags",
   "Option3": "c) precision",
   "Option4": "d) decimal",
   "Answer": " b",
   "Explaination": "Explanation: Flags specify output justification such as Left-justify within the data given field width, Displays the data with its numeric sign, used to provide additional specifiers like o, x, X for octal, left padding of a number."
 },
 {
   "Question": "What symbol is used to Left-justify within the data given field width?",
   "Option1": "a) -(minus sign)",
   "Option2": "b) +(plus sign)",
   "Option3": "c) #",
   "Option4": "d) 0",
   "Answer": " a",
   "Explaination": "Explanation: To left-justify the data use minus sign(-) in the flags field."
 },
 {
   "Question": "What specifies the minimum number of characters to print after being padded with zeros or blank spaces?",
   "Option1": "a) flags",
   "Option2": "b) length",
   "Option3": "c) width",
   "Option4": "d) precision",
   "Answer": " c",
   "Explaination": "Explanation: width specifies the minimum number of positions in the output."
 },
 {
   "Question": "The maximum number of characters to be printed is specified by __________",
   "Option1": "a) precision",
   "Option2": "b) width",
   "Option3": "c) length",
   "Option4": "d) flags",
   "Answer": " a",
   "Explaination": "Explanation: Precision specifies the maximum number of characters to print."
 },
 {
   "Question": "________is used to define the type and the interpretation of the value of the corresponding argument.",
   "Option1": "a) precision",
   "Option2": "b) specifiers",
   "Option3": "c) flags",
   "Option4": "d) decimal",
   "Answer": " b",
   "Explaination": "Explanation: Specifiers is used to define the type and the interpretation of the value of the corresponding argument. Example: c for a single character, d for decimal values etc. "
 },
 {
   "Question": "A conversion specification %7.4f means ____________",
   "Option1": "a) print a floating point value of maximum 7 digits where 4 digits are allotted for the digits after the decimal point",
   "Option2": "b) print a floating point value of maximum 4 digits where 7digits are allotted for the digits after the decimal point",
   "Option3": "c) print a floating point value of maximum 7 digits",
   "Option4": "d) print a floating point value of minimum 7 digits where 4 digits are allotted for the digits after the decimal point",
   "Answer": " a",
   "Explaination": "Explanation: The conversion specification %7.4f means that it will print floating point number maximum of 7 digits and 4 digits after the decimal point."
 },
 {
   "Question": "Choose the correct description for control string %-+7.2f.",
   "Option1": "a) – means display the sign, + means left justify, 7 specifies the width and 2 specifies the precision",
   "Option2": "b) – means left justify, + means display the sign, 7 specifies the width and 2 specifies the precision",
   "Option3": "c) – means display the sign, + means left justify, 7 specifies the precision and 2 specifies the width",
   "Option4": "d) – means left justify, + means display the sign, 7 specifies the precision and specifies the width",
   "Answer": " b",
   "Explaination": "Explanation: The given control string %-+7.2f means that – is for left justify, + to display sign, 7 specifies the precision and 2 specifies the width."
 },
 {
   "Question": "What error is generated on placing an address operator with a variable in the printf statement?",
   "Option1": "a) compile error",
   "Option2": "b) run-time error",
   "Option3": "c) logical error",
   "Option4": "d) no error",
   "Answer": " b",
   "Explaination": "Explanation: Placing an address operator with a variable in the printf statement will generate a run-time error."
 }
]

有人可以帮我测验屏幕如何从JSON文件中调用问题的格式,其中问题位于中间的顶部选项(作为单选按钮),并使用Submit按钮检查答案,并在答案后的底部显示说明。被回答。以及如何限制数据,例如从具有1000个值的数据库中调用10个值]

这是JSON文件。 [{“”问题“:” printf()函数的语法为printf(“控制字符串,变量列表);控制字符串的原型是什么?”,“ Option1”:“ a)%[flags] [.. ..

json flutter flutter-layout
1个回答
0
投票
class Question {
    String question;
    String option1;
    String option2;
    String option3;
    String option4;
    String answer;
    String explaination;

    Question({
        this.question,
        this.option1,
        this.option2,
        this.option3,
        this.option4,
        this.answer,
        this.explaination,
    });
}
© www.soinside.com 2019 - 2024. All rights reserved.