Question

QUESTION 10 What will be the output of following code snippet? char *str; str = "%s";...

QUESTION 10

  1. What will be the output of following code snippet?

    char *str;

    str = "%s";

    printf(str, "S");

    A.

    S

    B.

    Garbage Value

    C.

    Compile-time Error

    D.

    Run-time Error

4 points   

QUESTION 11

  1. What will be the output of the following statements assuming that the array begins at the memory address location 7002 and size of an integer is 4 bytes?

    int a[3][4] = { 1, 2, 3, 4,

                        5, 6, 7, 8,

                        9, 10, 11, 12 };

    printf("%d, %d, %d", a[0]+1, *(a[0]+1), *(*(a+0)+1));

    A.

    6998, 4, 4

    B.

    7224, 2, 2

    C.

    7006, 2, 2

    D.

    Run-time Error

0 0
Add a comment Improve this question Transcribed image text
Answer #1

10) A.  S
11) C.  7006, 2, 2
Add a comment
Know the answer?
Add Answer to:
QUESTION 10 What will be the output of following code snippet? char *str; str = "%s";...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 In order to print the members of structures in the array, what will be...

    QUESTION 1 In order to print the members of structures in the array, what will be the contents of blanks in the printf statement of the code snippet given below? #include <stdio.h> struct virus {    char signature[25];       char status[20]; } v[2] = {                               "Yankee Doodle", "Deadly",                               "Dark Avenger", "Killer"                   } ; void main( ) {       for (int i = 0; i < 2; i++)                   printf( "\n%s %s", _______________ , _____________ ); } A. signature, status B. v.signature,...

  • Consider the following code. Assume that the array begins at memory address Ox200. What is printed...

    Consider the following code. Assume that the array begins at memory address Ox200. What is printed by the following code. Assume sizeof(int) is 4 bytes and sizeof(char) is 1 byte. Do not include the Ox or leading zeros in your answer. Enter -1 if the answer is indeterminate, or -2 if the code generates a compile error, or -3 if the code generates a runtime error. #include <stdio.h> int main() { int a[] {1,2,3}; int *iptr a; printf("%p\n", iptr+1); return...

  • OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main()...

    OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...

  • Consider the following snippet of code. (Assume that input strings are at most 255 characters long.)...

    Consider the following snippet of code. (Assume that input strings are at most 255 characters long.) char* to_upper_case(char* original) { char capstr[255]; unsigned int i; for (i = 0; original[i] != '\0'; ++i) { if (original[i] >= 'a' && original[i] <= 'z') { capstr[i] = original[i] - (char)'a' + (char)'A'; } else { capstr[i] = original[i]; } } capstr[i] = '\0'; return capstr; } void main() { printf("%s", to_upper_case("the c programming language")); } a) What will be the output? Trace...

  • QUESTION 1 What is the output of the following code snippet? int main() { bool attendance...

    QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...

  • Given the struct xx with the following members: int x-3; char namell-"hello"; What would be the...

    Given the struct xx with the following members: int x-3; char namell-"hello"; What would be the output of the following program? 1. void main) 2. 3. struct xx "s-malloc(sizeof(struct xx)); 4, printf("%d",s->x); 5. printf("%s",s->name); 3 hello Garbage value hello 3 Garbage Value Compiler error None of the above

  • 51. What is the output of the following code snippet? int number = 0; int ptr_num...

    51. What is the output of the following code snippet? int number = 0; int ptr_num -&number ptr_num 60; number-80 cout < "ptr num << endl b, 60 c. 80 d. the address of number Answer 52. What is the output of the following code snippet? double num-0.0; double* ptr = &num; num = 15.0; ptr ptr 15.0 cout << num <<"ptr <<endl; a. 15 15 b. 15 30 С. 30 15 d. 30 30 Answer: 53. What is the...

  • PLease explain output of these two programs: 1. #include <stdio.h> typedef struct { char *name; int...

    PLease explain output of these two programs: 1. #include <stdio.h> typedef struct { char *name; int x, y; int h, w; } box; typedef struct { unsigned int baud : 5; unsigned int div2 : 1; unsigned int use_external_clock : 1; } flags; int main(int argc, char** argv){ printf("The size of box is %d bytes\n", sizeof(box)); printf("The size of flags is %d bytes\n", sizeof(flags)); return 0; } 2. #include <stdio.h> #include <string.h> /* define simple structure */ struct { unsigned...

  • 24. What will be the output of the following code #include<stdio.h> int main() { char *p;...

    24. What will be the output of the following code #include<stdio.h> int main() { char *p; p="%d\n"; p++; p++; printf(p-2, 100); return 0; } a. 100 b. 00 c. 10 d. compiler error e. none of the above 26. What will be the output of the following code #define TRIPPLE(x) (3*x) int x = 4; printf(“triple(%d) = %d \n”,x+1, TRIPPLE(x+1)); a. triple(5) = 12 b. triple(5) = 13 c. triple(4) = 14 d. triple(4) = 15 e. none of the...

  • 9. Which of the following is true for the following program? #include <stdio.h> int maino int...

    9. Which of the following is true for the following program? #include <stdio.h> int maino int i = 1; switch (0) case 1: printf("%d", 0); case 2: printf("%d", 0); case 3: printf("%d", 0); default: printf("%d", 1); return 0; } (2 points) The program has no error, the output is 1111 The program has no error, the output is 1 The program produces a compile time error, because there are no break statements The program produces a compile time error, because...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT