Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose a character in C is stored in memory as 0 1 0 1 0 0 0 1 What is this character? (Just type the

Suppose a character in C is stored in memory as

0 1 0 1 0 0 0 1

What is this character? (Just type the single char in the answer box, don't type others).

Suppose you need an int mask whose binary representation is

0 0 0 .... 0 1 1 1 1 0 1 1

How do you declare mask in ANSI-C code? List three ways of doing it in standard C, without using any arithmetic operators (+ - x * %) and bitwise operators (>> << & ^ ~) in your answers.

Consider the code snippet.

char msg[] = "HelloWorld";

strcpy(msg, "Good");

strcpy(msg, "OK");

Draw (write) the internal storage of array msg after the 2nd and the 3rd line, respectively.

Note that you should draw (write) the full storage of the array. Such as H e l l o \0 a b c \0

after 2nd line: ?

after 3rd line: ?

Suppose abc is an int variable with some value. The bits representation of abcis 00...1011101110.

List the right most 10 bits of abc after the statement

abc = abc & ~(017 << 2);

Suppose a string called msg has the content

'O' 'K' '\0' 'H' 'i' 'T' 'h' 'e' 'r' 'e' '\0' '\0'

1) what is the value of strlen(msg) and size of (msg)?

2) what is the internal storage of msg if we call strcat (msg, "ByeNow")?

3) what is the internal storage of msg if we call strncat (msg, "ByeNow", 2)?

For 2)3), draw (write) the internal storage of array msg such as O K \0 H i T h e r e \0 \0

Note that 2) and 3) are NOT related. Note that you should draw (write) the full storage of the array.

1) ?

2) ?

3) ?

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

More Books

Students also viewed these Databases questions