Question

1. Which exemplifies Cs weak type checking? (a) the ability to assign pointers of any type to/from a (void *) variable without warning (b) the requirement that all variables be declared before being used (c) the static nature of variable typese.g., once declared an int, always an int (d) the fact that data type widths (e.g., for ints) can be dependent on the platform 2. Consider the following macro definition and variable declaration #define F00(x) (2 * x-x) int val 10; 5)? What is the value of the expression F00 (val (a) 15 (b) 20 (c) 25 (d) 35 3. Consider the following variable and function definitions int g = 10; int q30 static int g = 5; return ++g; int q40 [ extern int g; return ++g; int q5O int g = 1; return ++g; What is the value of the expression q3O (a) 32 (b) 34 (c) 38 (d) 40 30 q4) q4) q5 q5)?

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

`Hey,

Note: In case of any queries, just comment in box I would be very happy to assist all your queries

1) What exemplifies C's Weak type checking?

The compiler cannot statically check most of the uses of void/* . void* may change to a pointer of any sort of type without any cast (Which applies on to C, And not C++) which is another weakness. C is taken into account to be typed fragile. As a result of which you will be able to convert any type to the other type with the cast and without a compile error.

So, Option A is the answer. i.e, The ability to assign pointers of any type to/form a (void *) variable without warning.

2) What is the value of the expression F00(val + 5)?

Considered the following macro definition and variable declaration : -

#define F00(x) (2 * x - x)

int val=10;

Answer

First option is in the given question let us test with 15 first. So x is 15,

F00(val + 5) = F00(15)

therefore x=15

So,

F00(15) = (2 * 15 - 15) = 15

Condition satisfies and the answer is Option A.

The condition does not satisfy for rest of the options.

3) What is the value of the expression q3() + q3() + q4() + q4() + q5() + q5() ?

Here, q3() is 6

q4() is 11

q5() is 2

Therefore, q3() + q3() + q4() + q4() + q5() + q5()

6+6+11+11+2+2 = 38.

Option C = 38 is the answer.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
1. Which exemplifies C's weak type checking? (a) the ability to assign pointers of any type...
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
  • Consider the following methods’ headers: public static int one(int a, char b, double c, String d)...

    Consider the following methods’ headers: public static int one(int a, char b, double c, String d) public static double two(double x, double y) public static char three(int r, int s, char t, double u) Answer the following questions: Q1) What is the signature of method one? Answer: Q2) What is the return type of method two? Answer: Q3) What the formal parameters of method three? Answer: Q4) How many actual parameters are needed to call the method three? Answer: Q5)...

  • problem 2 and 3 1. For each variable (a-g) describe whether the variable itself is global...

    problem 2 and 3 1. For each variable (a-g) describe whether the variable itself is global or local, static or not static, and initialized or uninitialized. (Hints: Global variables are always static. Local variables become static when declared with 'static'. For pointers, consider the pointer itself, not anything the pointer might point to.) 2. For each variable (a-g), describe where it is located when DoFunctionB is running. That is, for each variable, describe whether it is on the stack, in...

  • 10. Which of the following correcthy milites elements each with value 0? super Bass to com...

    10. Which of the following correcthy milites elements each with value 0? super Bass to com I inttl superBass { 0, 0, 0, 0, 0 ); int(1 superBass = new int [5] inttl superBass = new int (5) for (int i = 0; i < super Bass.length superBass ) = 0; +) (A) (B) I only II only I and II only I and III only I. II, and III (D) (E) 17. Consider the following Java program public class...

  • Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts...

    Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts What code is human-readable and follows the standards of a programming language? Secret code Source code Key code None of these Machine code Question 3 2 pts What is the symbol that marks the beginning of a one line comment? Question 1 2 pts The preprocessor executes after the compiler. True False Question 5 2 pts A statement that may be used to stop...

  • Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p;...

    Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p; int i; int k; i = 42; k = i; p = &i; After these statements, which of the following statements will change the value of i to 75? A. k = 75; B. *k = 75; C. p = 75; D. *p = 75; E. Two or more of the answers will change i to 75. Consider the following statements: int i =...

  • 1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program!...

    1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program! 3     public static void main(String[] args) { 4         System.out.println("Hello, World!"); 5     } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...

  • Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the...

    Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following keywords is useful for skipping to the next iteration of a loop? Select one: a. do b. break c. switch d. continue e. while Clear my choice Question 2 Not yet answered Marked out of 1.00 Flag question Question text Consider the following line of Java code. System.out.println("Hello, World!"); "out" is which of the following? Select one: a. a statement b. a class...

  • I need help on this Systems review please! it's due by midnight monday. Question 1 Not...

    I need help on this Systems review please! it's due by midnight monday. Question 1 Not yet answered Points out of 1.00 Flag question Question text Using these declarations: int * numberPointers[3]; int * pointer; int number; Which of the following statements would generate a warning or error? Select one: a. number = pointer; b. *pointer = number; c. pointer = numberPointers; d. numberPointers[2] = &number; e. a., b., and d. f. a. and c. Question 2 Not yet answered...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

  • This assignment is comprised of 3 parts: ​All files needed are located at the end of...

    This assignment is comprised of 3 parts: ​All files needed are located at the end of the directions. Part 1: Implementation of Dynamic Array, Stack, and Bag First, complete the Worksheets 14 (Dynamic Array), 15 (Dynamic Array Amortized Execution Time Analysis), 16 (Dynamic Array Stack), and 21 (Dynamic Array Bag). These worksheets will get you started on the implementations, but you will NOT turn them in. ​Do Not Worry about these, they are completed. Next, complete the dynamic array and...

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