Holidaying………Safely

December 20, 2007

If you plan to travel during this season don’t forget to pack some good sense. Read on…..

Before you leave

  • Know where you are going. Plan ahead.
  • Tell someone where you’re going. Make sure a close family member has your itinerary and phone number.
  • Turn it off! – turn off your electric appliances and stove at home. Don’t just turn off the gas regulator; separate it from the LPG cylinder.
  • Pack enough pills – Take prescription medicine enough to get you there and back.
  • Have a friend house-sit. Give house keys to close friends and have them watch your house while you’re gone or arrange for security.

Travelling by road?

  • Be ready for anything – Make sure your vehicle is maintained. Make sure you have all papers of your car. Carry a good map.
  • Pack snacks – Pack food and water for the long ride. Eat before you hit the road.
  • Carry the essentials – Flashlight, first aid kit, baby needs, drinking water…….
  • Don’t get stuck – Carry a mobile phone.
  • Alcohol and Bitumen don’t mix. Drunken driving is inexcusable and is an offence.

Going on a beach holiday this winter?

  • Remember ‘FLAGS’ when you visit the beach:
    * Find the red and yellow flags and swim between them
    * Look at the safety signs
    * Ask a lifeguard for advice
    * Get a friend to swim with you
    * Stick your hand up and shout for help if in difficulty
  • A beach is not like a swimming pool. The ocean has waves, rocks and cliffs. All these things can be lot of fun but also dangerous.
  • Take care of children. Don’t leave them alone on the beach.
  • Look out for deep water & strong currents; Always assume high waves can reach you
  • Be careful of cliffs and rocks. Do not climb them. They will be slippery
  • Don’t turn your back to the ocean. Watch out for “Sneaker waves” which are unpredictable and appear suddenly. They will have enough force to knock you down and drag you into the sea.
  • Pack a good sun screen lotion.

Structures & Unions in C problems

December 20, 2007

*************************************************************************************************
* NOTE : All the programs are tested under Turbo C/C++ compilers. *
* It is assumed that, *
* *=> Programs run under DOS environment, *
* *=> The underlying machine is an x86 system, *
* *=> Program is compiled using Turbo C/C++ compiler. *
* *=> Necessary header files are included. *
* The program output may depend on the information based on this assumptions. *
* (For example sizeof(int) = 2 bytes may be assumed). *
*************************************************************************************************

[Q001]. What will be the output of the following program :
struct {
int i;
float f;
}var;
void main()
{
var.i=5;
var.f=9.76723;
printf(“%d %.2f”,var.i,var.f);
}
(a)Compile-Time Error (b)5 9.76723 (c)5 9.76 (d)5 9.77
Ans. (d) Though both and are optional, one of the two
must appear. In the above program, i.e. var is used. (2 decimal places or)
2-digit precision of 9.76723 is 9.77
_________________________________________________________________________________________________

[Q002]. What will be the output of the following program :
struct {
int i;
float f;
};
void main()
{
int i=5;
float f=9.76723;
printf(“%d %.2f”,i,f);
}
(a)Compile-Time Error (b)5 9.76723 (c)5 9.76 (d)5 9.77
Ans. (d) Both and are optional. Thus the structure
defined in the above program has no use and program executes in the normal way.
_________________________________________________________________________________________________

[Q003]. What will be the output of the following program :
struct values{
int i;
float f;
};
void main()
{
struct values var={555,67.05501};
printf(“%2d %.2f”,var.i,var.f);
}
(a)Compile-Time Error (b)55 67.05 (c)555 67.06 (d)555 67.05
Ans. (c) The members of a structure variable can be assigned initial values in much the same
manner as the elements of an array. The initial values must appear in order in which they will be
assigned to their corresponding strucutre members, enclosed in braces and separated by commas.
_________________________________________________________________________________________________

[Q004]. What will be the output of the following program :
typedef struct {
int i;
float f;
}values;
void main()
{
static values var={555,67.05501};
printf(“%2d %.2f”,var.i,var.f);
}
(a)Compile-Time Error (b)55 67.05 (c)555 67.06 (d)555 67.05
Ans. (c) In the above program, values is the user-defined structure type or the new user-defined
data type. Structure variables can then be defined in terms of the new data type.
_________________________________________________________________________________________________

[Q005]. What will be the output of the following program :
struct my_struct{
int i=7;
float f=999.99;
}var;
void main()
{
var.i=5;
printf(“%d %.2f”,var.i,var.f);
}
(a)Compile-Time Error (b)7 999.99 (c)5 999.99 (d)None of these
Ans. (a) C language does not permit the initialization of individual structure members within the
template. The initialization must be done only in the declaration of the actual variables. The
correct way to initialize the values is shown in [Q003] or [Q004].
_________________________________________________________________________________________________

[Q006]. What will be the output of the following program :
struct first{
int a;
float b;
}s1={32760,12345.12345};
typedef struct{
char a;
int b;
}second;
struct my_struct{
float a;
unsigned int b;
};
typedef struct my_struct third;
void main()
{
static second s2={‘A’,- -4};
third s3;
s3.a=~(s1.a-32760);
s3.b=-++s2.b;
printf(“%d %.2f\n%c %d\n%.2f %u”,(s1.a)–,s1.b+0.005,s2.a+32,s2.b,++(s3.a),–s3.b);
}
(a)Compile-Time Error (b)32760 12345.12 (c)32760 12345.13 (d)32760 12345.13
A 4 a -5 a 5
1 -5 0.00 65531 0.00 65530
Ans. (d) Illustrating 3 different ways of declaring the structres : first, second and third are
the user-defined structure type. s1, s2 and s3 are structure variables. Also an expression of the
form ++variable.member is equivalent to ++(variable.member), i.e. ++ operator will apply to the
structure member, not the entire structure variable.
_________________________________________________________________________________________________

[Q007]. What will be the output of the following program :
struct {
int i,val[25];
}var={1,2,3,4,5,6,7,8,9},*vptr=&var;
void main()
{
printf(“%d %d %d\n”,var.i,vptr->i,(*vptr).i);
printf(“%d %d %d %d %d %d”,var.val[4],*(var.val+4),vptr->val[4],*(vptr->val+4),(*vptr).val[4],*((*vptr).val+4));
}
(a)Compile-Time Error (b)1 1 1 (c)1 1 1 (d)None of these
6 6 6 6 6 6 5 5 5 5 5 5
Ans. (b) Since value of the member ‘i’ can be accessed using var.i, vptr->i and (*vptr).i
Similarly 5th value of the member ‘val’ can be accessed using var.val[4], *(var.val+4),
vptr->val[4], *(vptr->val+4), (*vptr).val[4] and *((*vptr).val+4)
________________________________________________________________________________________________

[Q008]. What will be the output of the following program :
typedef struct {
int i;
float f;
}temp;
void alter(temp *ptr,int x,float y)
{
ptr->i=x;
ptr->f=y;
}
void main()
{
temp a={111,777.007};
printf(“%d %.2f\n”,a.i,a.f);
alter(&a,222,666.006);
printf(“%d %.2f”,a.i,a.f);
}
(a)Compile-Time error (b)111 777.007 (c)111 777.01 (d)None of these
222 666.006 222 666.01
Ans. (c) This program illustrates the transfer of a structure to a function by passing the
structure’s address (a pointer) to the function.
_________________________________________________________________________________________________

[Q009]. What will be the output of the following program :
typedef struct {
int i;
float f;
}temp;
temp alter(temp tmp,int x,float y)
{
tmp.i=x;
tmp.f=y;
return tmp;
}
void main()
{
temp a={111,777.007};
printf(“%d %.3f\n”,a.i,a.f);
a=alter(a,222,666.006);
printf(“%d %.3f”,a.i,a.f);
}
(a)Compile-Time error (b)111 777.007 (c)111 777.01 (d)None of these
222 666.006 222 666.01
Ans. (b) This program illustrates the transfer of a structure to a function by value. Also the
altered structure is now returned directly to the calling portion of the program.
_________________________________________________________________________________________________

[Q010]. What will be the output of the following program :
typedef struct {
int i;
float f;
}temp;
temp alter(temp *ptr,int x,float y)
{
temp tmp=*ptr;
printf(“%d %.2f\n”,tmp.i,tmp.f);
tmp.i=x;
tmp.f=y;
return tmp;
}
void main()
{
temp a={65535,777.777};
a=alter(&a,-1,666.666);
printf(“%d %.2f”,a.i,a.f);
}
(a)Compile-Time error (b)65535 777.777 (c)65535 777.78 (d)-1 777.78
-1 666.666 -1 666.67 -1 666.67
Ans. (d) This program illustrates the transfer of a structure to a function by passing the
structure’s address (a pointer) to the function. Also the altered structure is now returned
directly to the calling portion of the program.
_________________________________________________________________________________________________

[Q011]. What will be the output of the following program :
struct my_struct1{
int arr[2][2];
};
typedef struct my_struct1 record;
struct my_struct2{
record temp;
}list[2]={1,2,3,4,5,6,7,8};
void main()
{
int i,j,k;
for (i=1; i>=0; i–)
for (j=0; j<2; j++)
for (k=1; k>=0; k–)
printf(“%d”,list[i].temp.arr[j][k]);
}
(a)Compile-Time Error (b)Run-Time Error (c)65872143 (d)56781243
Ans. (c) This program illustrates the implementation of a nested structure i.e. structure inside
another structure.
_________________________________________________________________________________________________

[Q012]. What will be the output of the following program :
struct my_struct{
int i;
unsigned int j;
};
void main()
{
struct my_struct temp1={-32769,-1},temp2;
temp2=temp1;
printf(“%d %u”,temp2.i,temp2.j);
}
(a)32767 -1 (b)-32769 -1 (c)-32769 65535 (d)32767 65535
Ans. (d) An entire structure variable can be assigned to another structure variable, provided
both variables have the same composition.
_________________________________________________________________________________________________

[Q013]. What will be the output of the following program :
struct names {
char str[25];
struct names *next;
};
typedef struct names slist;
void main()
{
slist *list,*temp;
list=(slist *)malloc(sizeof(slist)); // Dynamic Memory Allocation
strcpy(list->str,”Hai”);
list->next=NULL;
temp=(slist *)malloc(sizeof(slist)); // Dynamic Memory Allocation
strcpy(temp->str,”Friends”);
temp->next=list;
list=temp;
while (temp != NULL)
{
printf(“%s”,temp->str);
temp=temp->next;
}
}
(a)Compile-Time Error (b)HaiFriends (c)FriendsHai (d)None of these
Ans. (c) It is sometimes desirable to include within a structure one member i.e. a pointer to the
parent structure type. Such structures are known as Self-Referencial structures. These structures
are very useful in applications that involve linked data structures, such as lists and trees.
[A linked data structure is not confined to some maximum number of components. Rather, the data
structure can expand or contract in size as required.]
_________________________________________________________________________________________________

[Q014]. Which of the following declarations is NOT Valid :
(i) struct A{
int a;
struct B {
int b;
struct B *next;
}tempB;
struct A *next;
}tempA;

(ii) struct B{
int b;
struct B *next;
};
struct A{
int a;
struct B tempB;
struct A *next;
};

(iii)struct B{
int b;
}tempB;
struct {
int a;
struct B *nextB;
};

(iv) struct B {
int b;
struct B {
int b;
struct B *nextB;
}tempB;
struct B *nextB;
}tempB;
(a) (iv) Only (b) (iii) Only (c)All of the these (d)None of these
Ans. (d) Since all the above structure declarations are valid in C.
_________________________________________________________________________________________________

[Q015]. What will be the output of the following program :
union A{
char ch;
int i;
float f;
}tempA;
void main()
{
tempA.ch=’A';
tempA.i=777;
tempA.f=12345.12345;
printf(“%d”,tempA.i);
}
(a)Compile-Time Error (b)12345 (c)Erroneous output (d)777
Ans. (c) The above program produces erroneous output (which is machine dependent). In effect,
a union creates a storage location that can be used by any one of its members at a time. When a
different member is assigned a new value, the new value supercedes the previous member’s value.
[NOTE : The compiler allocates a piece of storage that is large enough to hold the largest
variable type in the union i.e. all members share the same address.]
_________________________________________________________________________________________________

[Q016]. What will be the output of the following program :
struct A{
int i;
float f;
union B{
char ch;
int j;
}temp;
}temp1;
void main()
{
struct A temp2[5];
printf(“%d %d”,sizeof temp1,sizeof(temp2));
}
(a)6 30 (b)8 40 (c)9 45 (d)None of these
Ans. (b) Since int (2 bytes) + float (4 bytes) = (6 bytes) + Largest among union is int (2 bytes)
is equal to (8 bytes). Also the total number of bytes the array ‘temp2′ requires :
(8 bytes) * (5 bytes) = (40 bytes).
_________________________________________________________________________________________________

[Q017]. What will be the output of the following program :
void main()
{
static struct my_struct{
unsigned a:1;
unsigned b:2;
unsigned c:3;
unsigned d:4;
unsigned :6; // Fill out first word
}v={1,2,7,12};
printf(“%d %d %d %d”,v.a,v.b,v.c,v.d);
printf(“\nSize=%d bytes”,sizeof v);
}
(a)Compile-Time Error (b)1 2 7 12 (c)1 2 7 12 (d)None of these
Size=2 bytes Size=4 bytes
Ans. (b) The four fields within ‘v’ require a total of 10 bits and these bits can be accomodated
within the first word(16 bits). Unnamed fields can be used to control the alignment of bit fields
within a word of memory. Such fields provide padding within the word.
[NOTE : Some compilers order bit-fields from righ-to-left (i.e. from lower-order bits to high-
order bits) within a word, whereas other compilers order the fields from left-to-right (high-
order to low-order bits).
_________________________________________________________________________________________________

[Q018]. What are the largest values that can be assigned to each of the bit fields defined in
[Q017] above.
(a)a=0 b=2 c=3 d=4 (b)a=1 b=2 c=7 d=15 (c)a=1 b=3 c=7 d=15 (d)None of thes
Ans. (c)a=1 (1 bit: 0 or 1)
b=3 (2 bits: 00 or 01 or 10 or 11),
c=7 (3 bits: 000 or 001 or 010 or 011 or 100 or 101 or 110 or 111)
d=15 (4 bits: 0000 or 0001 or 0010 or 0011 or 0100 or 0101 or 0110 or 0111 or 1000 or
1001 or 1010 or 1011 or 1100 or 1101 or 1110 or 1111)
_________________________________________________________________________________________________

[Q019]. What will be the output of the following program :

void main()
{
struct sample{
unsigned a:1;
unsigned b:4;
}v={0,15};
unsigned *vptr=&v.b;
printf(“%d %d”,v.b,*vptr);
}
(a)Compile-Time Error (b)0 0 (c)15 15 (d)None of these
Ans. (a) Since we cannot take the address of a bit field variable i.e. Use of pointer to access
the bit fields is prohibited. Also we cannot use ’scanf’ function to read values into a bit field
as it requires the address of a bit field variable. Also array of bit-fields are not permitted
and a function cannot return a bit field.
_________________________________________________________________________________________________

[Q020]. What will be the output of the following program :
void main()
{
static struct my_struct{
unsigned a:1;
int i;
unsigned b:4;
unsigned c:10;
}v={1,10000,15,555};
printf(“%d %d %d %d”,v.i,v.a,v.b,v.c);
printf(“\nSize=%d bytes”,sizeof v);
}
(a)Compile-Time Error (b)1 10000 15 555 (c)10000 1 15 555 (d)10000 1 15 555
Size=4 bytes Size=4 bytes Size=5 bytes
Ans. (d) Here the bit field variable ‘a’ will be in first byte of one word, the variable ‘i’ will
be in the second word and the bit fields ‘b’ and ‘c’ will be in the third word. The variables
‘a’, ‘b’ and ‘c’ would not get packed into the same word. [NOTE: one word=2 bytes]
_________________________________________________________________________________________________


Priyanka Chopra – Photo gallery

December 16, 2007


After winning the title of Miss India World and later becoming Miss World 2000, Chopra made her acting debut with Anil Sharma’s The Hero: Love Story of a Spy (2003). She had her first commercial success with her second release, Andaaz from the same year and won a Filmfare Best Female Debut Award for her performance in the film. Becoming the second woman to win the Filmfare Best Villain Award for her critically acclaimed performance in Abbas-Mustan’s Aitraaz (2004), Chopra later went on to deliver commercial success with films like Mujhse Shaadi Karogi (2004), Krrish (2006), her biggest commercial success so far, and Don – The Chase Begins Again (2006), establishing herself as a popular actress

Taare Zameen Par

December 16, 2007

Aamir Khan with a child actor in a still from the movie Taare Zameen Par.


Jodhaa Akbar Theatrical Movie Trailer

December 14, 2007

he theatrical release of the movie trailer for Jodhaa Akbar, starring Hrithik Roshan and Aishwarya Rai-Bachchan. Movie releasing on January 25, 2008

There is no evidence that Anarkali even existed or Prince Salim (Jahangir) ever fell in love with a Courtesan. It’s just a legend. Anyways he did marry a muslim woman name Noor Jahan and a hindu Rajput princess name Manmati. Manmati was the mother of Shah Jahan, the person who built the Taj mahal.


Aamir Khan Plays Shankar’s ‘Robot’?

December 14, 2007
This is the new grapevine that is spreading in the industry. It is said that no sooner than Sharukh Khan turned off to go ahead with Shankar for the film ‘Robot’, Aamir Khan is turning on for the same. The projects left out by SRK are being taken away by Aamir Khan and they are proving to be hits. Now Aamir Khan is continuing the same old phenomenon again. The Interesting aspect is that Aamrir Khan is willing to produce this scientific thriller as well by investing about a Rs 100 cr. Another factor to be underlined is that Ameer Khan is going to play dual role in this film as scientist and Robot. The plot goes this way- A scientist invents a Robot to take care of his child. But when he knows that the Robot kills a few people, he puts an end to it.

Earlier when Shankar narrated this theme to SRK, Hrithik is supposed to play Robot and SRK, the scientist. Now both are to be played by Aamir Khan.

No one knows how far truth holds in this gossip. It is also said that Ajith is showing interest in working with Shankar for Robot. Let us wait until the news comes officially.


India moves to the fourth spot in ICC Test rankings

December 14, 2007
The 1-0 win in the three-match Test series against Pakistan has helped India move to the fourth spot in the International Cricket Council (ICC) Test Championship rankings.

Both India and South Africa have 109 points. But when calculated to decimal point South Africa is a fraction of point ahead of India in the third spot. Australia is still the leading team in the rankings with 143 points followed by England in the second place with 111 points.

Pakistan following the series loss are now fifth with 94 points while Sri Lanka are fifth with 105 points.

The ICC Test Championship is only updated at the end of each series. This is because a team that wins a series outright receives an additional bonus. As such, the impact of the ongoing series between Sri Lanka and England will only be felt at the end of the third Test, which begins in Galle, Dec 18.

England needs to win that match if it is to retain its second position on the ladder. If it only manages a draw or if it is defeated in Galle, then it will fall to a lowly fifth spot.

A draw would give Sri Lanka a 1-0 series win and move it up to third on the list but if Mahela Jayawardena’s team can finish the series 2-0 up, it would shoot up to second place, ahead of South Africa and India.

ICC Test Championship:

1. Australia 143
2. England 111
3. South Africa 109
4. India 109
5. Sri Lanka 105
6. Pakistan 94
7. New Zealand 91
8. West Indies 72
9. Bangladesh 4


Okka Magadu TRAILER 2 – Balayya Dialogues

December 14, 2007


Okka Magadu TRAILER

December 14, 2007


AdSense FAQ

December 14, 2007

Google AdSense is commonly used for many businesses to advertise. The way that this works is that websites that are accepted into the Google AdSense program are allowed to display adverts on their website using special javascript code that they get from Google. Every time that a person clicks on the advert the website hosting the adverts will earn money.

I am going to look at one of the most important aspects of Google Adsense. This is channels which are used specifically to allow the advertiser to track the details of their advertisements. This is particularly useful to which adverts are performing very well and also to see which pages are getting the most hits on your web site.

Read the rest of this entry »