Monday, May 16, 2011

[discussion_vu] My Today's CS201 Paper 16-05-2011

Assalam-o-Alykum
here is my today's CS201 Paper


Consider the structure     2 Marks

 

struct Customer

{

int custnum;

int salary;

float commission;

};

 

A programmer wants to assign 2000 for the structure member salary in the above example of structure Customer with structure variable cust1 What line of code should he write

 

Why are arrays usually processed with for loop? 2 Marks

What are the basic steps of file handling? 3 Marks

When a pointer is incremented, what happens in the following cases? 3 Marks

  a) Single-dimensional array

  b) Two-dimensional array

 

If int array[10]; is an integer array then write the statements which will store values at Fifth and Ninth location of this array. 5 Marks

Write down the output of the code given below : 5 Marks

Hint:

Size of  char is 1 byte

Size of  int is 2 byte

Size of  float is 4 byte

 

#include <iostream.h>

 

union mytypes_t {

  char c;

  int i;

  float f;

  } mytypes;

 

int main(){

   

    mytypes.c = 'H';

    mytypes.i = 15;

   

    cout << sizeof(mytypes)<<endl;

   

    mytypes.i = 15;

    mytypes.c = 'H';

   

    cout << sizeof(mytypes)<<endl;

   

    system("PAUSE");

    return 0;

}

 




--
You received this message because you are subscribed to the Google Groups "Virtual University of Pakistan" group.
To post to this group, send email to discussion_vu@googlegroups.com.
To unsubscribe from this group, send email to discussion_vu+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/discussion_vu?hl=en.

No comments:

Post a Comment

PAID CONTENT