Question

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]

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

answer: A,D,E
  

main.cpp 1 #include <iostream> 2 using namespace std; 3 int main() 4- { int b[] = {10, 20, 30}; int *x = b + 1; cout<<*b; ret

main.cpp 1 #include <iostream> 2 using namespace std; 3 int main() 4-{ int b[] = {10, 20, 30}; int *x = b + 1; cout<<x[-1]; o

main.cpp 1 #include <iostream>, 2 using namespace std; 3 int main() int b[] = {10, 20, 30}; int *x = b + 1; cout<<x[1] - b[1]

########################################################

Give a ThumbsUp if you found this answer Helpful :)
#######################################################

################################################################
............ Still having trouble understanding the answer ? Feel free to ask in the comment section.......

Add a comment
Know the answer?
Add Answer to:
Assume the following declarations: int b[] = {10, 20, 30}; int *x = b + 1;...
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
  • 1. (3% each) Given the following declarations: int a-4 int b-6: float5.0 Evaluate the following Java...

    1. (3% each) Given the following declarations: int a-4 int b-6: float5.0 Evaluate the following Java expressions: a) (5 + a / b) % 2- b) c / (10 % b) C) 5 * 300 7 + 8 / 3-6

  • Which are invalid variable declarations that will cause compiler errors? a. int number$1 = 10; b....

    Which are invalid variable declarations that will cause compiler errors? a. int number$1 = 10; b. int number#1 = 10; c. int 21stJump = 10; d. int number_1 = 10; e. int Number1 = 10;

  • 4. Consider the following declarations: I. const int* x I. const int const x II. int...

    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 declarations I-V with the following: (a) the integer it points to can change in value. A pointer to an integer that can never change the address it points to, but (b) A pointer to a pointer to an integer A pointer whose address can never change, and whose integer value that (c) it points to...

  • Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array...

    Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array double[10]; c. charl charArray "Computer Science"; None of the above Analyze the following code: class Test public static void main(Stringl] args) System.out.println(xMethod(10); public static int xMethod(int n) System.out.println("int"); return n; public static long xMethod(long n) System.out.,println("long"); return n The program displays int followed by 10 The program displays long followed by 10. The program does not compile. None of the above. tions 3-4 are...

  • 24) A C program has the following declarations: float x = 10.0, y = 5.5, z...

    24) A C program has the following declarations: float x = 10.0, y = 5.5, z = 2.1; int i = 3, j = 5, k = 7, m; EVALUATE each of the following expressions. SHOW YOUR WORK, including the type of each sub expression (indicating a float with a decimal point). If the expression would compile and runs but would produce garbage output, mark GARBAGE and EXPLAIN. If you are not confident of your answer, type in, compile and...

  • 11. What is the output of the following program fragment? int v[5] = {10, 20, 30,...

    11. What is the output of the following program fragment? int v[5] = {10, 20, 30, 40, 50}; for (int i=3; i>0; i--) { cout << v[i] << " "; } A. 102030 B. 302010 C. 403020 D. 40302010 12. Given the following code: char a[20]; char b[30]; Copy(a, b); // Copy all elements of b into a What is the best signature (header) of the Copy function? A. void Copy(char x[], char y[]) B. void Copy(const char x[], char...

  • Suppose the following declarations and statement are m effect What are the values of and b...

    Suppose the following declarations and statement are m effect What are the values of and b in each ease? int a = 10, b - 20, x = &a, y = &b; x = y; int a - 10, b - 20, x =6a, y =&b; x = y; x = 2; y = 5; int a = 10, b = 20, x =&a, y = &b; x = y; x + = 2; [y] --;

  • given the following declarations int x; float y = 99.5; write a C++ code that will...

    given the following declarations int x; float y = 99.5; write a C++ code that will cast y to an int and store the result in x.

  • assume we have the following constant declarations const int MAXIMUM = 60; const int letters_Size =...

    assume we have the following constant declarations const int MAXIMUM = 60; const int letters_Size = 15; we then have the function void Adjusting(char C_string[ ] [ ], int amount_words); assume that youve taken in a string from the user now just simply read the input wnd analyze the sentence into its parts and describe its roles basically parse into words and save it and sort into an array of C-strings. note code is in C++ complete the function definition...

  • Assume you have the following variable declarations and assignments: int j2: int k3; char c'h float...

    Assume you have the following variable declarations and assignments: int j2: int k3; char c'h float x2.3 Write single printf command to print the following output. The value of j is 2, and the value of x is -2.30, and the character c contains the value h. Note: You must make use of the variables as indicated by the desired output. For example, if the required output is: The value of j is 2. Then the following answer would be...

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