Question

Question 31 In C, what is the computational result of 8/5*2.5? Question 32 Examine the for...

Question 31

In C, what is the computational result of 8/5*2.5?

Question 32

Examine the for statement given below. What is the most correct answer given below?

for(degrees==0.0; degrees<=360.0; degrees+=20.0)

( )

Degrees must be in radians.

( )

Degrees must be capitalized.

( )

Cannot use double equal signs for assigning values to variables.

( )

Degrees cannot be incremented in the manner shown.

Question 33

In a C program the formal and actual parameters that are used between a main function and a user-defined function must match in order, number, and type.

( ) True

( ) False

Question 34

Examine the following C programming segments. What is the value assigned to new_temperature?

double temperature = 75.5;

int new_temperature;

new_temperature = temperature/2.0;

( )

37.0

( )

37.75

( )

37

( )

None of the above.

Question 35

The return statement in a void function does not contain an expression.

( ) True

( ) False

Question 36

In C, if the data type of an actual parameter is the same as the corresponding formal parameter then coercion of arguments will occur.

( ) True

( ) False

Question 37

Examine the C program segment given below. How many iterations will the for loop complete?

int sum=0, count;

for(count=1; count<=9; count+=2)

{

   sum=sum+3/2;

}

printf(“Sum = %2i”,sum);

( )

10

( )

9

( )

5

( )

11

Question 38

A while loop cannot be used to write data to an output file.

( ) True

( ) False

Question 39

What C character cannot be at the end of the for statement in order for it to function properly? Must be exact C coding.

Question 40

Assume an input data file already exists and contains the values given below. What type of looping structure listed below would be best suited to read the data?

5

0.0,132.5

0.1,147.2

0.2,148.3

0.3,157.3

0.4,163.2

( )

for

( )

do/while

( )

while

( )

None of the above.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hello learner,

Thanks for the question.

Question 31:

8/5*25-> when 8/5 in C, as both 8 & 5 are integer it will give remainder output that 1 and when 1*2.5 it will given output as 2.5.

So the answer is 2.5.

Question 32:

As for loop has 3 parts i.e. intialization, condition & increment. In the intialization we can’t use ==.

So correct answer is option 3.

Question 33:

Yes, function protype(return type, argument sequence and argumnet type ) while function declaration, function defination and function calling must match otherwise the compiler will given error.

So answer is True.

Question 34:

Output of the below code will be 37, because in C when 75.5/2.0 it will give result as 37.75 but as the varaiable new_ temperature is integer type, So the values after decimal is ignored and hence the answer is 37.

double temperature = 75.5;

int new_temperature;

new_temperature = temperature/2.0;

So the answer will be 37.

Question 35:

If the functions return type is void that means it shouldn’t return anything. Soit can’t return an expression or any variable.

So the answer will be true.

Question 36:

In C, the datatype of actual argument and corresponding formal argument must be the same, otherwise the compiler will throw error.

So the statement given is false

Question 37:

The for loop in the given statement will run for 5 time.
Initially the count value will be 1, after the first loop it will be increment by 3 ,5 , 7 , 9, 11.

When the count value is 11 then the for loop condition will fail and program

execution will come out.

So the answer is 5.

Question 38:

Yes, we can use while loop for reading the content of the file. Please find the below sample code:

#include <stdio.h>

int main() {

char ch

FILE *f;

f= fopen ('sample.txt', 'r');

while( (ch = getc(f)) != EOF) {

printf('%ch', ch);

}

fclose(fp);

return 0;

}

So the statement given is false.

Question 39:

We can’t have “;” at the end of for loop because adding semicolon at the end will not execute any statement after this until the loop exit.

So the answer will be “;”.

Question 40:

We can use while loop to read the content of the file, As I have provide a sample code of reading the file in Question 38.

So answer is while() loop.

Add a comment
Know the answer?
Add Answer to:
Question 31 In C, what is the computational result of 8/5*2.5? Question 32 Examine the for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 1 What is the value of x after the following int x = 5; x++;...

    Question 1 What is the value of x after the following int x = 5; x++; x++; x+=x++; A)14 B)10 C)13 D)15 Question 2 The last line in value returning function (before the }) should contain the word return. True False Question 3 This contains three parts: Void or Data Type the name optional parameter list A)Menu System B)Function Header C)Switch Question 4 What is a variable? A)a pointer B)a place in memory to hold data C)int D)a computer programming...

  • QUESTION 1 Which statement results in the value false? The value of count is 0; limit...

    QUESTION 1 Which statement results in the value false? The value of count is 0; limit is 10. (count != 0)&&(limit < 20) (count == 0)&&(limit < 20) (count != 0)||(limit < 20) (count == 0)&&(limit < 20) 10 points    QUESTION 2 If this code fragment were executed in an otherwise correct and complete program, what would the output be? int a = 3, b = 2, c = 5 if (a > b) a = 4; if (...

  • What is the output of the following C++ code? int count = 1; int num =...

    What is the output of the following C++ code? int count = 1; int num = 25; while (count < 25) { num--; count++; } cout << count « " " « num << endl i 25 1 0 24 1 0 25 0 0 24 0 In this while loop statement, while (counter < 10), where counter is an int variable. Which statement below is an equivalent way to write this while statement? while (10 < counter) while (9...

  • ​​​​​​ 11.   A _____________ error does not cause the compiler to generate an error, but does...

    ​​​​​​ 11.   A _____________ error does not cause the compiler to generate an error, but does cause the program to produce incorrect results. Syntax, logic, variable name, function name 12.   A syntax error occurs when the programmer violates one or more grammar rules of the C language. True or False 13.   Given this line of code: y = sqrt(x); x would be known as the argument. True or False 14.   A void function does not return a value to the...

  • Question 32 (Programming) The Fibonacci sequence of number is defined as: In this question we examine...

    Question 32 (Programming) The Fibonacci sequence of number is defined as: In this question we examine a property of this sequence. a) Write a C function definition with header int fib(int [ ] a, int n) which generates an array, a of the first n Fibonacci numbers. (Hint: You do not have to write this recursively. You just have to generate each array entry from the previous two entries.) b) Two numbers are said to be coprime if they have...

  • JAVA QUESTION 1 The value returned by a value-returning method can be saved for further calculation...

    JAVA QUESTION 1 The value returned by a value-returning method can be saved for further calculation in the program. True False QUESTION 2 To use a predefined method you must know the code in the body of the method. True False QUESTION 3 A formal parameter is a variable declared in the method heading (ie. it's signature). True False QUESTION 4 A local identifier is an identifier that is declared within a method or block and that is visible only...

  • 1. (TCO 1) What is the output of the following C++ code? int list[5] = {0,...

    1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++)      cout << list[j]; (Points : 4)         0 1 2 3 4         0 5 10 15         0 5 10 15 20         5 10 15 20 Question 2.2. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j...

  • COSC 112 Test #3 Spring 2019 20. It is not necessary to specify the parameter name...

    COSC 112 Test #3 Spring 2019 20. It is not necessary to specify the parameter name in the parameter list of a function prototype even 21. Which of following is not a situation when reference parameters are useful? though there is a default parameter. (True/False) a. When you don't want to have side effects b. When you need to change the actual parameter c. When you need to return more than one value d. When you want to save memory...

  • Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C -...

    Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...

  • Attached to this assignment as a separate document is the C++ code for a program that...

    Attached to this assignment as a separate document is the C++ code for a program that determines if a given string is a palindrome or not. A palindrome is a word that is spelled the same backward or forward. "bob" is an example of a palindrome. The program is sometimes a talking point during lecture, and may not fully adhere to the many bobisms I've been telling you about. In fact, it may not entirely work but that wasn't its...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT