1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pickupchik [31]
3 years ago
9

1. An integer in C (int) is represented by 4 bytes (1 byte = 8 bits). Find the largest integer that can be handled by C. Verify

that number by computer (try to printf that number, and printf that number +1). No programming is required for this. Hint: (a) Conversion from binary to decimal: 3 2 1 0 2 1101 =1 2 + 0 2 +1 2 +1 2 = 8 + 0 + 2 +1 10 =11 (b) If an integer is represented by 1 byte (8 bits), the maximum integer number is 1111111 (Seven 1's as one bit must be reserved for a sign). 6 5 0 2 1111111 =1 2 +1 2 ++1 2 1 2 1 7 =  − =128 −1 (c) The number looks like a telephone number in Dallas.
Computers and Technology
1 answer:
faust18 [17]3 years ago
4 0

Answer:

Check the explanation

Explanation:

In C, int requires 4 butes to sotre a integer number. that means it requires 4*8 = 32 bits. The maximum number can be stored using 32 bits is

(11111111111111111111111111111111)_2

The first digit is used for sign. decimal equivalent to this number can be computed as

(1111111111111111111111111111111)_2= 1\times2^{30}+1\times2^{29}+...+1\times2^0

=1\times2^{31}-1

= 2147483647-1=2147483646

That means int can store a up to 2147483646.

                      Testing with C code

#include<stdio.h>

int main()

{

  int a = 2147483647; // a with max number

  printf("%d\n",a);// printing max number

  a = a+1;// adding one to the number

  printf("%d\n",a);// printing the number after adding one

  return 0;

}

                THE OUTPUT

$ ./a.out

2147483647

-2147483648

You might be interested in
What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is
BigorU [14]

Answer:

Option D is correct.

Explanation:

Option D is correct because  when the condition  if (list[j] < temp) is tested it only gets true when element in list[] array at <em>jth</em> position is less than the value in <em>temp</em> and after that it increments the value of c by this statement: c++ and so c is incremented from 0 to as much times as much elements in list[] are lesser than temp.

6 0
3 years ago
Read 2 more answers
Read the following characteristic:
Ivanshal [37]

Answer:

A goal of procedural programming

An advantage of object oriented programming

A disadvantage of object oriented programming

A drawback of procedural programming

3 0
2 years ago
Which item below is NOT output? A. monitor B. speakers C. printer D. mouse
Molodets [167]
D. mouse that is  your answer <span />
6 0
3 years ago
Read 2 more answers
Which of the following is an example of a Syntax Error?
quester [9]

Answer:

The correct answer is: "The program does not run at all."

Explanation:

The rules to write a program in any language are called syntax. The error in syntax of a language is called syntax error. Syntax errors are usually detected during the compilation of the program. The program cannot be run untill all syntax errors are removed.

So,

The correct answer is: "The program does not run at all."

7 0
3 years ago
What is the maximum number of ip addresses that can be assigned to hosts on a local subnet that uses the 255.255.255.224 subnet
FinnZ [79.3K]
30 including the router.
7 0
3 years ago
Other questions:
  • The Caesar Cipher has 25 different shifts to try.
    14·1 answer
  • Write a program that reads in the length and the width of a rectangular yard.
    5·1 answer
  • Although the Earth's crust formed relatively early in the Earth's history, it was not present when the Earth first began to form
    12·2 answers
  • A mobile device is freezing almost daily. The device remains powered on and the screen illuminated. The user restarts the device
    8·1 answer
  • Maria works for MegaCorp, a large privately owned company specializing in sales of ball bearings. MegaCorp introduces filtering
    15·1 answer
  • Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have alre
    6·1 answer
  • Should the federal government have bug bounty programs? Why or why not?
    9·2 answers
  • Help me with this please
    5·1 answer
  • Select all of the reasons Windows 95 increased the popularity of Windows.
    12·1 answer
  • Can someone answer me
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!