Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

17. Let arr be declared as int arr[20] then the statement *(arr+20) = 20; A. generates a runtime error B. generates a compiling error (syntax

17. Let arr be declared as int arr[20] then the statement *(arr+20) = 20; A. generates a runtime error B. generates a compiling error (syntax error) C. sets the last element in the array to 15 D. overwrites the memory beyond the end of the array E. None of the above 18. What will be the output of the following code? In the system alignment is at multiple of 4, size of int is 4 bytes, size of short is 2 bytes struct student { int id; short GPA; }; struct employee { short salary; long stockOptions; }. union person { struct student s; struct employee e; } p1; p1.e.salary = 55; p1.s .id = 115; printf(student id = %d ,p1.s.id); printf(person salary = %d ,p1.e.salary); 19. True of False write beside each option whether it is true or false 1. If the frame stack contains 250 frames then the program has called a recursive function 2. The first function in the frame stack is main() 3. When a program executes then the frame stack must contain at least two functions 4. The scope of a variable is the block of code that it is declared in. 5. Function parameters are stored in the frame stack 6. Static variables that are declared in a function are stored in the frame stack 7. The function malloc() allocates memory from the heap and initializes all the bytes to 0 8. The statement int *p = (int *) malloc(100); allocates memory for 100 integers 20. Given that size of a short is 2 bytes, int 4 bytes, long 4 bytes, float 4 bytes and double is 8 bytes. What is the size of the following union structure if the alignment is a multiple of 4? union x { short age; long salary; double stockOptionValue; }; A. 8 B. 14 C. 16 D. None of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions