Question: QUESTION 1 Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated
QUESTION 1
Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated by a variable called total.
QUESTION 2
Convert the following decimal number : 39 to binary
QUESTION 3
Convert the following hexadecimal number : C94 to binary
QUESTION 4
Convert the following hexadecimal number : E72 to binary
QUESTION 5
Convert the following decimal number : 47 to binary
QUESTION 6 Convert the following binary number : 1110001 to decimal
QUESTION 7
Print the following message on the screen with one line of code: "Hello , this is a C program"
QUESTION 8
Write a statement that adds variable x to variable sum and assign the result to sum.
QUESTION 9
convert the following decimal number : 84 to binary
QUESTION 10
Write a single C statement to accomplish the following: Assign the sum of x and y to z and increment the value of x by 1 before the calculation. __________________________
QUESTION 11
The _____ standard library function displays information on the screen.
QUESTION 12
. sum = num1 + num2; and num1 + num2 = sum; are both valid C statements. True False
QUESTION 13
All variables must be given a type when they are declared. True False
QUESTION 14
#include This is a pre-processor directive that tells to include the standard input/output header file in the program. True False
QUESTION 15
int m, n, x, y ; m= 10; n = 20; x = 15; y = m + n / x; After the last stattement is executed the value of y will be 11 True False
QUESTION 16
Every C statement ends with ; True False
QUESTION 17
#define TRUE 1 #define FALSE 0 These pre-procesoor directives will define the words TRUE and FALSE to be used as boolean variables True False
QUESTION 18
scanf("%d", num1); Assuming that num1 is an integer variable, will the above statement run properly? True False
QUESTION 19
Comments cause the computer to print the text enclosed between /* */ on the screen when the program is executed.
True False QUESTION 20
C will consider the variables number and NUmber identical. True False
QUESTION 21
int m, n, x, y ; m= 6; n = 4; x = 5; y = m + n / x; After the last statement is executed the value of y will be 2 True False
QUESTION 22
What will be printed out when the following code executes? int num = 91;
switch (num) { case 90: printf("90 ");
case 91: printf("91 ");
break;
case 92: printf("92 ");
break;
default: printf("default ");
}
2. 91 91 default 91 92 90 91
QUESTION 23
Given: int a= 36, b= 7, result; result = a / b ;
The value of result will be: 2. 5.142857 5 6 1
QUESTION 24
Which of the following are valid C expressions. 2. number1 = number2 *(number3 + number4);
number + sum = z ;
sum = sum + number;
7 = number ;
QUESTION 25
Which of the following is a complete, legal C program?
#include main() { int 4score = 0;
printf(Hello, world );
} D. #include init() { printf(Hello, world );
} C. #define PI main() { printf(Hello, world );
} A. #include #include #define HALF 0.5 main() { printf(Hello, world );
}
QUESTION 26
What is the value of the variable intResult, given: int a = 3, b = 2, c = 10, intResult; intResult = c - a / b; 2. 3 3.5 8.5 9 QUESTION 27 1. Which variable names are valid piece Flag sum$Value int sum 1counter taxRate pieceFlag QUESTION 28 1. long int ivar1, ivar2 = 20, ivar3 = 6; double dvar1, dvar2 = 1.2, dvar3 = 4.5; ivar1 = dvar2; printf("ivar1= %i ", ivar1); This program will display (content of ivar1): 2. 1.2 1.0 1 none of the above
QUESTION 29
What will be the output (content of ivar1) with the following code: long int ivar1, ivar2 = 20, ivar3 = 6; double dvar1, dvar2 = 1.2, dvar3 = 4.5; ivar1 = ivar2 % ivar3 * 2; printf("ivar1= %i ", ivar1); 2. 6 4 3 none of the above
QUESTION 30
What will be the ouput with the following code: long int ivar1, ivar2 = 20, ivar3 = 6; double dvar1, dvar2 = 1.2, dvar3 = 4.5; dvar1 = (double) ivar2 / ivar3; printf("dvar1= %lf ", dvar1); 2. 3 3.333333 3.000000 none of the above
QUESTION 31
Given: int x,y,result; x = 9; y = 10; result = x + y * 3 - 12; The value of result will be : 27 45 -171 none of the above
QUESTION 32
In a switch staement the default case is required True False
QUESTION 33
In case that you have to compare a range of values in a multiple selection statement you cannot use the switch statement. You will have to use if-else True False
QUESTION 34
An else statement may have an associated if, but is optional. True False
QUESTION 35
In a switch staement the default case is required True False
QUESTION 36 1. An if statement may have an associated else True False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
