Note: You are currently viewing documentation for Moodle 3.2. Up-to-date documentation for the latest stable version of Moodle is probably available here: Quiz developer docs.

Quiz developer docs: Difference between revisions

From MoodleDocs
(Created page with "Which of the following output should be used to obtain a remainder after dividing 3.14 by 2.1 ? A) rem= modf(3.14,2.1); B) rem =fmod(3.14,2.1); C) rem=3.14%2.1; D) Remainder cann...")
 
(redirect to dev docs)
 
Line 1: Line 1:
Which of the following output should be used to obtain a remainder after dividing 3.14 by 2.1 ?
#redirect [[:dev:Quiz]]
A) rem= modf(3.14,2.1);
B) rem =fmod(3.14,2.1);
C) rem=3.14%2.1;
D) Remainder cannot be obtain in floating point division.
ANSWER: C
 
What are the type of linkages?
A) External and None
B) Internal
C) Internal and External
D) External,Internal and None
ANSWER: D
 
Which of the following special symbol allowed in a variable name?
A) * (asterisk)
B) - (hyphen)
C) _ (underscore)
D) | (pipeline)
ANSWER: C
 
 
4 Is there any difference between following these declarations ?
1. extern int fun();
2. int fun();
A) No difference, except extern int fun(); is probably in another file
B) Both are identical
C) int fun(); is overrided with extern int fun();
D) None of these
ANSWER: A
 
5  How would you round off a value from 1.66 to 2.0?
A) ceil(1.66)
B) floor(1.66)
C) roundup(1.66)
D) roundto(1.66)
 
ANSWER: A
 
6. 
By default a real number is treated as a
A) float
B) double
C) long double
D) far double
 
ANSWER: B
 
7. 
Which of the following is not user defined data type?
1 :
struct book
{
    char name[10];
    float price;
    int pages;
};
2 :
long int l = 2.35;
3 :
enum day {Sun, Mon, Tue, Wed};
A) 1
B) 2
C) 3
D) Both 1 and 2
ANSWER:  B
 
Is the following statement a declaration or definition?
extern int i;
A) Declaration
B) Definition
C) Function
D) Error
ANSWER: A
 
9. 
Identify which of the following are declarations
1 :
extern int x;
2 :
float square ( float x ) { ... }
3 :
double pow(double, double);
A) 1
B) 2
C) 1 and 3
D) 3
ANSWER: C
 
 
 
10. 
In the following program where is the variable a getting defined and where it is getting declared?
#include<stdio.h>
int main()
{
    extern int a;
    printf("%d\n", a);
    return 0;
}
int a=20;
A) extern int a is declaration, int a = 20 is the definition
B) int a = 20 is declaration, extern int a is the definition
C) int a = 20 is definition, a is not defined
D) a is declared, a is not defined
ANSWER: A
 
 
11. 
When we mention the prototype of a function?
A)  Defining
B) Declaring
C) Prototyping
D) Calling
ANSWER: B
 
 
12. 
What is the output of the program given below ?
#include<stdio.h>
int main()
{
    enum status { pass, fail, atkt};
    enum status stud1, stud2, stud3;
    stud1 = pass;
    stud2 = atkt;
    stud3 = fail;
    printf("%d, %d, %d\n", stud1, stud2, stud3);
    return 0;
}
A) 0, 1, 2
B) 1, 2, 3
C) 0, 2, 1
D) 1, 3, 2
ANSWER: C
 
13. 
What will be the output of the program in 16 bit platform (Turbo C under DOS)?
#include<stdio.h>
int main()
{
    extern int i;
    i = 20;
    printf("%d\n", sizeof(i));
    return 0;
}
A) 2
B) 4
C) vary from compiler
D) Linker Error : Undefined symbol 'i'
ANSWER: D
 
14. 
What is the output of the program?
#include<stdio.h>
int main()
{
    extern int a;
    printf("%d\n", a);
    return 0;
}
int a=20;
A) 20
B) 0
C) Garbage Value
D) Error
ANSWER: A
 
15. 
What is the output of the program in Turbo C (in DOS 16-bit OS)?
#include<stdio.h>
int main()
{
    char *s1;
    char far *s2;
    char huge *s3;
    printf("%d, %d, %d\n", sizeof(s1), sizeof(s2), sizeof(s3));
    return 0;
}
A) 2, 4, 6
B) 4, 4, 2
C) 2, 4, 4
D) 2, 2, 2
ANSWER: C

Latest revision as of 07:16, 13 March 2012

Redirect to: