Briefly explain the following terms in the context of the C programming language. Use code fragments to illustrate your explanation (per item 1 mark for explanation and 1 mark for code fragment): i. Unsigned Long Integer Literal ii. Bit-wise AND operator iii. Storage class static. iv. Expression v. Size of short vs int vs long
Added by Nancy J.
Step 1
Sure! Let's break down each term step by step. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 66 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
1. What is abstraction? a. The removal of the non-essential parts of a program. b. The separation of what something does from how it does it. c. The act of moving from concrete examples to more general cases. d. Writing pseudocode. 2. Which of the following is NOT determined by the type of a variable? a. The number of bits needed to store it in memory. b. How to interpret the stored bits. c. The scope of the variable. d. None of the above. (All of the above are determined by type.) 3. For the following code, assuming a short integer is 16 bits, short y = 30000; short x = y + 10000; Which one of the following best describes the types present? a. The expression y + 10000 is a short, and overflow occurs when assigning to the short x. b. The expression y + 10000 is an integer, and overflow occurs when assigning to the short x. c. The short y overflows when it is first initialized. d. The expression y + 10000 is a short, and no overflow occurs when assigning to the short x. 4. What is the output of the following code? double d = 4.669; printf("My number is %.2f.", d); 5. For the following code, int x = 5; double d1 = 11 / x; double d2 = 11 / (double)x; What is the value of d1 – d2?
Akash M.
1) Convert binary to unsigned int Problem: Convert a binary string to decimal. Accept buffered user input in the form of a 16-bit binary string. Convert to unsigned integer and print to the screen. If the user enters less than 16 bits, you may pad the binary number with zeros on the left. Sample Execution: Enter a 16-bit binary number: 1001111001011100 The decimal unsigned integer equivalent is 40540. Enter a 16-bit binary number: 01100 The decimal unsigned integer equivalent is 12. 2) Convert binary to signed int Problem: Convert a binary string to decimal. Accept buffered user input in the form of a 16-bit binary string. Convert to signed integer and print to the screen. If the user enters less than 16 bits, or inputs illegal character, return an error message and prompt for input again. Sample Execution: Enter a 16-bit binary number: 1001111001011100 The decimal signed integer equivalent is -24996. Enter a 16-bit binary number: 11001011100 Error! Please enter exactly 16-bits: 1001111001011100 Enter a 16-bit binary number: 110/\\\\ˆ01011100 Error! Illegal characters detected. Please enter a 16-bit binary number: 1001111001011100 The decimal signed integer equivalent is -24996.
Adi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD