Question

State whether each of the following is true or false. If false, explain why: a.Referring to...

State whether each of the following is true or false. If false, explain why:

a.Referring to an array element outside the array bounds is a syntax error.

b.When initializing an array at its declaration, it is a syntax error to provide less initializers than the number of array elements.

c.A character array can be initialized using a string literal.

d.An individual array element that is passed to a function and modified in that function will contain the modified value when the called function completes execution.

e.When a not-initialized pointer is dereferenced, it initializes itself to NULL

f.The fields of a struct can be of different types, but the array elements cannot.

g.structs and arrays are always passed to functions by reference

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

Answers are

a) Answer is False

Referring to an array element outside the array bounds is a logical and execution error

b.) Answer is False

When initializing an array at its declaration, and we provide less initializers than the number of array elements. then it is not a syntax error instead remaining elements will already initialize to 0

c )  Answer is True

Yes we can initialize a character array using a string literal

d) Answer is False

We can pass values to function in two types

  1. Pass by value: In this method the modification don't reflect in original array
  2. Pass By Reference : in this method the modification made in function will reflect in original array

So it is false as we can also pass the individual element by value so modification done will not effect in array after function ends

e) Answer is False

Non -Initialize pointer point to some random location in memory it is not initialized to null by default

f) Answer is True

Yes Struct can have several data types elements but array contain elements with same data type

g) Answer is False

Structs can be passed by value and reference but array are passed by reference only .

So these are the correct answers for each part

If u have any doubt then ask in comment

DO Upvote the answer if u like it

Add a comment
Know the answer?
Add Answer to:
State whether each of the following is true or false. If false, explain why: a.Referring to...
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
  • True or False: Algorithms should be specified in pseudocode before they are implemented in C

     17.True or False: Algorithms should be specified in pseudocode before they are implemented in C.  18. True or False: In C, false is defined as any result that is zero. 19. True or False: An advantage to defining functions in C is that they may be reused in other projects. 20. True or False: Suppose a function main calls a function f. As a parameter to f, main passes a pointer p to a struct. Further suppose that f's body modifies p by...

  • In C programming State whether the following are true or false. If the answer is false,...

    In C programming State whether the following are true or false. If the answer is false, give a few words to indicate why. Label your answers with the corresponding letter. A. A single array can store different types of values. B. A subscript can be type “float”. C. It is an error to initialize an array with fewer values then the declared size of the array. D. Passing an individual element of an array to a function allows the called...

  • Question 2 [5 points) State if each of the below statements is True or False 1...

    Question 2 [5 points) State if each of the below statements is True or False 1 2 3 The Compiler skips comments. A function can return a value of type array. An array index starts with 1. Pass by value is the default in CH, except when passing arrays as arguments to function The default storage class for local variables is static. A pointer provides an indirect means of accessing the value of a particular data item The logical operators...

  • 31. True or False: The condition in the following if statement is a syntax error:

     31. True or False: The condition in the following if statement is a syntax error: int number=50;…… if (number)…… 32. True or False: The standard C functlon strlen) will return 4 when invoked upon the varlable name, declared below: char namel = (e', 'p', 't', 's', '\0', '1', '2', '1', '\0']; 33. True or False: A structure is a collection of related variables under one name. 34. True or False: In C, output parameters allow for a function to return more than one value Indirectly. 35. True or...

  • Section 1: TRUE/FALSE (Please circle one) (I point for each question) 1. Staticvariables can be initialized...

    Section 1: TRUE/FALSE (Please circle one) (I point for each question) 1. Staticvariables can be initialized using other variables. 1. True 2. False 2. Declaration statements containing the word extern create new storage areas. 1. True 2. False 3. All computer operating systems use the same specification as to the maximum number of characters permitted for an external filename. 2. False 1. True 4. Using a subscript that references a nonexistent array element will always be detected by all C++...

  • State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator...

    State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator moves it from the back toward the front of a list b) The body of a do-while loop is always executed at least once. c) If p points to the array element a[j], then p + i points to a[i+j]. d) Any number of pointer variables may point to the same object. In terms of both execution speed and memory usage usually iterative solutions...

  • _28. Using the following function prototype which statement about the argument passed to parameter Als true....

    _28. Using the following function prototype which statement about the argument passed to parameter Als true. void F(const int A[], int Cnt): A. The argument is modified when changes are made to parameter A in function F. B. The argument passed to parameter A must always have the same number of elements, every time function Fis invoked. C. Changes can not be made to parameter A in function F. D. Every element of the argument passed to parameter A must...

  • this is true and false for C++ (1 point each) Circle T for true or F...

    this is true and false for C++ (1 point each) Circle T for true or F for false for the following questions. 1. T/F The Boolean expression b1 || b2 evaluates to true if either Boolean value (b1, b2) is true. T/F The code we write in C++ (e.g. code in file project1.cpp) is referred to as source code. 2. 3. T/F The statement float scores[3][3] creates 3 arrays, each containing 3 floating-point variables. T/F For loops work best when...

  • Fill the blank in each of the following using the terms at the bottom. IT. When...

    Fill the blank in each of the following using the terms at the bottom. IT. When an array is created, a value in the array is called a(n) 12. f and ) must always be used with an if) statement: True or False 13. Theoperator is used to check if two values are equal. 14. A command can only be used in a loop statement. 15. Acommand can be used in both a loop and switch statement. 16. In the...

  • State whether the following are true or false. For the false items, explain why they are...

    State whether the following are true or false. For the false items, explain why they are false.             a.   Enterprise Funds are used only when all services are provided to non-governmental entities, and Internal Service Funds are used only when all services are provided to governmental agencies that are a part of the reporting government.             b.   Enterprise Funds use the economic resources measurement focus and full accrual basis of accounting only when they want to compute the costs of...

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