CNIT 105 QUESTIONS & ANSWERS
Where was the C programming language developed at? - Answers -Bell Lab
C is an object oriented language. - Answers -false
What is the address operator in C? - Answers -&
What is the extension of the source file in a C program? - Answers -.c
Which statement will read data into variable number? Assume:
int number; - Answers -scanf("%d", &number)
Fill in the blanks to read data into variable length. Assume:
float length; - Answers -scanf("%f", &number)
Every C program must have a [x] function. - Answers -Main
What is the operator/symbol for preprocessor directive?
# - Answers -Main
Fill in the blank, assume:
int score ;
printf ("Enter a score: ");
scanf ("%d", [y]); - Answers -&score
Which statement prompts the user to input the age? Assume:
int age; - Answers -printf ("Enter your age: ");
The preprocessor goes through the C program [x] compilation. - Answers -before
In what decade was the C programming language developed? - Answers -1970's
Given the variable int count; Which statement will store 100 in count? - Answers -
count=100
To compute the square root of a number in C, one has to use the [x] function from the
math library. - Answers -sqrt
What will be stored in num?
int num = 7;
num++;
++num;
num--; - Answers -8
, What will be stored in m and n respectively by the following statements?
int m, n;
m = 4;
n = 6;
m = 3 * n++; - Answers -18,6
The goal is to check if the value stored in number is between 10 and 20, including 10
and 20. Which logical expression will do the job?
Assume: int number = ... // a value is stored in the variable - Answers -number >= 10
&& number <= 20
What will be stored in variable c after execution of the following code? Assume:
int a, b, c;
a = 11;
b = 6;
c = 9;
if (a >= b)
{
c = a + b;
}
if (a >= c)
{
c = a;
}
else
{
c = a * 2;
} - Answers -22
What is the output of executing the following code?
int n = 60;
if (n = 100)
printf ("We have reached 100!");
else
printf ("We are not there yet."); - Answers -We have reached 100! The = will assign 100
to n, the right code should have == instead of =
What will be displayed? Assume: int age = 19;
if (age < 21)
{ printf ("You may not drink. ");
if (age >= 18) printf ("You can vote! "); else { if (age >= 16) printf ("You can drive!"); else
printf ("You may not drive.");
}
}
else
{
Where was the C programming language developed at? - Answers -Bell Lab
C is an object oriented language. - Answers -false
What is the address operator in C? - Answers -&
What is the extension of the source file in a C program? - Answers -.c
Which statement will read data into variable number? Assume:
int number; - Answers -scanf("%d", &number)
Fill in the blanks to read data into variable length. Assume:
float length; - Answers -scanf("%f", &number)
Every C program must have a [x] function. - Answers -Main
What is the operator/symbol for preprocessor directive?
# - Answers -Main
Fill in the blank, assume:
int score ;
printf ("Enter a score: ");
scanf ("%d", [y]); - Answers -&score
Which statement prompts the user to input the age? Assume:
int age; - Answers -printf ("Enter your age: ");
The preprocessor goes through the C program [x] compilation. - Answers -before
In what decade was the C programming language developed? - Answers -1970's
Given the variable int count; Which statement will store 100 in count? - Answers -
count=100
To compute the square root of a number in C, one has to use the [x] function from the
math library. - Answers -sqrt
What will be stored in num?
int num = 7;
num++;
++num;
num--; - Answers -8
, What will be stored in m and n respectively by the following statements?
int m, n;
m = 4;
n = 6;
m = 3 * n++; - Answers -18,6
The goal is to check if the value stored in number is between 10 and 20, including 10
and 20. Which logical expression will do the job?
Assume: int number = ... // a value is stored in the variable - Answers -number >= 10
&& number <= 20
What will be stored in variable c after execution of the following code? Assume:
int a, b, c;
a = 11;
b = 6;
c = 9;
if (a >= b)
{
c = a + b;
}
if (a >= c)
{
c = a;
}
else
{
c = a * 2;
} - Answers -22
What is the output of executing the following code?
int n = 60;
if (n = 100)
printf ("We have reached 100!");
else
printf ("We are not there yet."); - Answers -We have reached 100! The = will assign 100
to n, the right code should have == instead of =
What will be displayed? Assume: int age = 19;
if (age < 21)
{ printf ("You may not drink. ");
if (age >= 18) printf ("You can vote! "); else { if (age >= 16) printf ("You can drive!"); else
printf ("You may not drive.");
}
}
else
{