AME CS1050 -CProgramming Quiz 10 SPRING 2017 Fill out the answer sheet with your
ID: 3721813 • Letter: A
Question
AME CS1050 -CProgramming Quiz 10 SPRING 2017 Fill out the answer sheet with your choices and turn the quiz in. DO NOT PUT YOUR ANSWERS ON THIS SHEET-RECORD THEM ON THE ANSWER SHEET ONLY 1) Which of the following statements is true about a String in C: a) a string in C is an array of characters ending in the null character b) string constants in C are written in double quotation marks d) all of the above e) none of the above c) the value of a string is the address of its first character 2) If I define a character array as follows: char namesl)-"williams: a) what value is in position names|1]? b) what value is in position names (8]? c) what is the length of array names? 3) Using the definitions below char s1 [ 50]-"jack, s2150 ]-jill a) jack d) none of the above a) what will this line of code print out >>> printf("%c%s", toupper( s1 [ 0 ] ). &s1;[1 ] ); b) what will this l ine of code print out >>> print fe%0%s", toupper( s2[1 j ). &s2;[ 0] ): a) JILL b) ijill c) ljil d) none of the above 4) MATCHING - match the term on the right with the definition on the left- USE AN ANSWER ONLY ONCE b)- ?aCfunction that returns a true value ifc is a digit or 3.isxdigt inte c) the character handler library you need to include 5. isalnum (int c ) a C function that returns a true value if c isa 1. isletdigit (int e): 2. hexidecimal digit a letter 4. ishexdigit int c ): to access character manipulation functions 6.Explanation / Answer
please do upvote .If you have any problem do comment and i will be happy to help you.Thanks for using Chegg.
------------
1)
answer: all of the above
explainnation:
we declare string in c as follows:
char names[]="wiiliams"
as you cana see above string is an array of characters and behind the scenes it is terminated by null character
, The constant williams is defined in double quotes
and when you print the aabove string using statement
printf("%s",&names[0])
the ouput will be williams hence the value of string is the address of its first character
2)
indexes and corresponding characters
0 w
1 i
2 l
3 l
4 i
5 a
6 m
7 s
'8 ''
a)names[1]=i
b)names[8]= null character
c) size = 9 = 8 characters in williams + 1 null terminated character
3)
a) you will get Jack beacause we are truning first letter as upper case (J) and then printing the from index 1 to last of string as it is (ack)
answer: (d) non of the above
b) you will get Ijill beacause we are truning first letter as upper case (I) and then printing the from index 0 to last of string as it is.(jill)
answer: (c)Ijill
4)
a) 3 .isxdigit() (is the function not other ones)
b) 5 . isalnum() ,(it checks if a character is alphanumeric or not)
c)7 .none of the above (beacause stdio.h is used for handling input and output while there is no standard library called charset.h )
5)
yes it will return true since E is an hexadecimal character
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.