Professional Documents
Culture Documents
Test1 Jawapan
Test1 Jawapan
QUESTION : 1
M
SOLUTION
a) FALSE 1
b) TRUE 1
c) FALSE 1
d) FALSE 1
e) TRUE 1
f) TRUE 1
g) TRUE 1
h) FALSE 1
i) FALSE 1
j) TRUE 1
______
TOTAL
10m
QUESTION : 2
SOLUTION M
a)
a b c d
int a = 0, b = 10, c = 5, d = 8; 0 10 5 8
b = ++a * b; 1 10 1
a *= c++; 5 5 1
c--; 6 0.5
d /= --c; 4 2 1
b = a % c++; 5 1 4 1.5
b)
______
TOTAL
10m
QUESTION : 3
SOLUTION M
a) Output:
Good afternoon 1
My favourite sport is tennis 1
I can speak Arabic 1
I have 1 brother and 2 sisters
2
b) Output:
______
TOTAL
10m
QUESTION : 4
SOLUTION M
a)
i) printf(“Enter a mark in integer value: ”); 1
int i=10;
b)
int j=1;
while(i>=j){
if(i%4==0) 1
break; 1
i-=3; 1
} 1
printf("%d\t%d", i, j); 1
1
1
______
TOTAL
10m
QUESTION : 5
SOLUTION M
#include <stdio.h>
int main() 0.5
{
int year, month, date, state, id; 1
if(id%2 == 0) 1
printf("\nGender is female\n"); 0.5
else 1
printf("\nGender is male\n"); 0.5
return 0;
}
______
TOTAL
10m
QUESTION : 6
SOLUTION M
#include<stdio.h>
int main() 0.5
{
int n, sum=0;
int min,max; 1
if (min % 2 == 0) 1
{ min++; } 1
for(n=min;n<=max;n+=2) 1.5
{
sum += n; 1
}