Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
c Objective Questions and Answers PDF

c Objective Questions and Answers PDF

Ratings: (0)|Views: 32|Likes:
Published by Irfan Baig
Uploaded from Google Docs
Uploaded from Google Docs

More info:

Published by: Irfan Baig on Apr 29, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

04/29/2012

pdf

text

original

 
8/28/2011
http://cquestionbank.blogspot.com
| Ritesh kumar
C
 
C
 
PROGRAMMING
 
QUESTIONS
 
AND
 
ANSWER
 
Copyright@ritesh kumar:http://cquestionbank.blogspot.com/
Page 2
1.What will be output when you will execute following ccode?#include<stdio.h> #definevar 3intmain(){char*cricket[var+~0]={"clarke","kallis"}; char*ptr=cricket[1+~0];printf("%c",*++ptr);return0;}Choose all that apply:(A) a(B) r(C) l(D) Compilation error(E) None of the aboveAnswer: (C)Explanation:In the expression of size of an array can have microconstant.var +~0 = 3 + ~0 = 3 + (-1) = 2
Let‟s assume string “clarke” and “kallis” has stored at
memory address 100 and 500 respectively as shown in thefollowing figure:
For string “clarke”:
 For string "kallis":
 
Copyright@ritesh kumar:http://cquestionbank.blogspot.com/
Page 3
In this program cricket is array of character‟s pointer
of size 2. So array cricket will keep the memoryaddress of first character of both strings i.e. contentof array cricket is:cricket[2] = {100,500}ptr is character pointer which is pointing to the fistelement of array cricket. So, ptr = 100Now consider on *++ptrSince ptr = 100 so after ++ptr, ptr = 101*(++ptr) = *(101) = content of memory address 101. Fromabove figure it is clear that character is l.2.What will be output of the following c program?#include<stdio.h> intmain(){int goto=5; printf("%d",goto); return0;}(A) 5(B) **(C) **(D) Compilation error(E) None of theseAnswer: (D)Explanation:Name of variable is invalid. goto is keyword in c.variable name cannot be any keyword of c language.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->