search
Log In
1 vote
1.3k views

What is the output of the following program: (Assume that the appropriate preprocessor directives are included and there is not syntax error)

main( )
    {   char S[]="ABCDEFGH";
        printf("%C", *(&S[3]));
        printf("%s", S+4);
        printf("%u", S);
    /*Base address of S is 1000 */
    }
  1. $\text{ABCDEFGH}1000$
  2. $\text{CDEFGH}1000$
  3. $\text{DDEFGHH}1000$
  4. $\text{DEFGH}1000$
in Programming
edited by
1.3k views

3 Answers

1 vote
 
Best answer

Ans is D

printf("%C", *(&S[3])); = D
        printf("%s", S+4); = EFGH
        printf("%u", S); = 1000

selected by
1 vote
Ans is DEFGH1000 none of the option matches...
1 vote

printf (“%C”, *(&S[3])); will print character at *(&S[3]) i.e. D.
printf (“%s”, S + 4); will print string starting from S + 4 i.e. EFGH.
printf (“%u”, S); will print address of S i.e. 1000.
Since there is no new line instruction, So DEFGH1000 will be the output.
So, option (D) is correct.

Answer:

Related questions

1 vote
2 answers
1
1.8k views
Given that $x=7.5, j=-1.0, n=1.0, m=2.0$ the value of $--x+j==x>n>=m$ is: $0$ $1$ $2$ $3$
asked Jul 30, 2016 in Programming jothee 1.8k views
2 votes
2 answers
2
924 views
Level order Traversal of a rooted Tree can be done by starting from root and performing: Breadth First Search Depth First Search Root Search Deep Search
asked Jul 30, 2016 in Programming jothee 924 views
1 vote
1 answer
3
122 views
Suppose you are compiling on a machine with $1$-byte chars, $2$-byte shorts, $4$-byte ints, and $8$-byte doubles, and with alignment rules that require the address of every primitive data element to be an integer multiple of the element's size. Suppose further that the compiler is not ... ; double r; int i; } A[10]; /*10 element array of structs */ $150$ bytes $320$ bytes $240$ bytes $200$ bytes
asked Nov 20, 2020 in Programming and DS jothee 122 views
1 vote
1 answer
4
1.5k views
Which of the following is not valid with reference to Message Passing Interface(MPI)? MPI can run on any hardware platform The programming model is a distributed memory model All parallelism is implicit MPI- Comm - Size returns the total number of MPI processes in specified communication
asked Jul 31, 2016 in Distributed Computing jothee 1.5k views
...