Question

4. Consider the following declarations: I. const int* x I. const int const x II. int const x; IV. int x V. int x Match declar
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution

//A
passing parameters by value in which any change in parameter only vaild inside the function. Outdside the function no change variable value

//B //C
passing parameters by reference in which any change in parameter change the variable value at memory level and also vaild to outside the function.

[A] No_A Yes_B Yes_C
[B] No_A Yes_B No_C
[C] Yes_A No_B No_C

>Share Lh Result Execute main.cpp STDIN #include <iostream> -o main.cpp Sg++ 2 Smain 3 using namespace std; 1 4 2 5 int fun1(Thank You So Much! Please Rate this answer as you wish.("Thumbs Up")

Add a comment
Know the answer?
Add Answer to:
4. Consider the following declarations: I. const int* x I. const int const x II. int...
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 5: A) Consider: int i=1; int fun(int x) { for(int i=0; i<4; i++) { x...

    Question 5: A) Consider: int i=1; int fun(int x) { for(int i=0; i<4; i++) { x += i; return x; What value is returned by a function call fun(1)? B In C, static variables can only be initialized by literals, not functions. For example, this is allowed: static int x = 5; But this is not allowed: static int x = compute_initial(); Why would this be the case? A Because you can never initialize a variable using a function, even...

  • After the following declarations and statements are executed:       int i, j, k ;       boolean...

    After the following declarations and statements are executed:       int i, j, k ;       boolean c;       float x, y,   z;       int[ ] num = {4, 1, 2, 3, 8};       i = 3;       j = 5;       x = 4.3;       y = 58.209;       c = !(i > j) ; what is the value of c

  • Memory Consider a process running the following program #include estdlib.h> #include #define const char* int int...

    Memory Consider a process running the following program #include estdlib.h> #include #define const char* int int <stdio.h> TO PRINT toPrintCPtr "Good luck!" TO PRINT; main for (i -0; i < sizeof (TO PRINT)-1; i++) printf("%c %c\n", toPrintCPt r [1], toupper(toPrintCPt r [i])); return(EXIT SUCCESS); Please tell where the following objects are stored in memory. Your choices are a. ROM BIOS b. kernal Memory (the OS) c. shared library memory (the glibc library) d. .text segment e. .rodata segment f. .data...

  • Consider the following function definition and variable declarations: void square(int &n){n= n*n;} int arr[] = {1,...

    Consider the following function definition and variable declarations: void square(int &n){n= n*n;} int arr[] = {1, 2, 3}; int number = 4; Which of the following function calls are acceptable? (can have multiple answer) a.square(1); b.square(2); c.square(arr[number]); d.square(number); What is the output of the following code segment? int arr[] = {1, 4, 1, 0}; for (int i=0; i < 4; ++i)     cout<<arr[i]*2; a.1014 b.1 4 1 0 (space in between each number) c.1410 d.0140 e.None of the above Given...

  • c language not c++ c language int mininum(int a[135) int i; int min. Question 2 (4...

    c language not c++ c language int mininum(int a[135) int i; int min. Question 2 (4 points) If ptr is an integer pointer and x in an integer variable then write one statement to set ptr to point to x then write another statement to increment x by 10 using ptr (not using x) (4 points) Question 3 (4 points) Saved

  • What is wrong with the following function definition? void fill(const int a[], int size) { for...

    What is wrong with the following function definition? void fill(const int a[], int size) { for (int i = 0; i < size; i++) {     a[i] = 0; } return; } Answers: The function cannot change the array parameter. The array should be passed as a call-by-reference, not call-by-value. The for loop causes an out-of-bounds indexing error. Nothing, the code works fine as is.

  • Write the following function: const int MIN_SIZE = 2; const int MAX_SIZE = 8; const int...

    Write the following function: const int MIN_SIZE = 2; const int MAX_SIZE = 8; const int UNKNOWN = 0; const int RED = 1; const int BLUE = 2; const char UNKNOWN_LETTER = '-'; const char RED_LETTER = 'X'; const char BLUE_LETTER = 'O'; const string UNKNOWN_STRING = "unknown"; const string RED_STRING = "X"; const string BLUE_STRING = "O"; /** * Requires: size <= MAX_SIZE and size is a positive even integer, *           0 <= row && row < size....

  • Consider the following type declarations TYPE A A Ti 12 T3 T4 TS TO T7 TH...

    Consider the following type declarations TYPE A A Ti 12 T3 T4 TS TO T7 TH intage pointer to float: pointer to Integer structurex Integer structure X A; next pointer to inte structura inter l oat structure float: aInteger structure la pointer to 15 pointer to TS structure la pointer to T i pointer to 15 structure la pointer to T i pointer to structure la pointer to 17 pointer to TS pointer to T7 pointer to 15 pointer to...

  • Assume the following declarations: int b[] = {10, 20, 30}; int *x = b + 1;...

    Assume the following declarations: int b[] = {10, 20, 30}; int *x = b + 1; Choose all the expressions that are defined and evaluate to 10 A. *b B. b[1] C. *x D. x[-1] E. x[1] - b[1]

  • 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 =...

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