PPS Mid 2 QB Objective
PPS Mid 2 QB Objective
#include<stdio.h>
main()
{
int i=10;
int *j=&i;
return 0;
}
A)j and i are pointers to an int
B)i is a pointer to an int and stores address of j
C)j is a pointer to an int and stores address of i
D j is a pointer to a pointer to an int and stores address of i
void main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf("%d,%d/n", *ptr, a);
}
A)10,10 B)10,11 C)11,11
D)11,10
54 Which is comment on the following? A
Constant *ptr;
A)You cannot change the value pointed by ptr
B)You cannot change the pointer ptr itself C)Both (a) and (b)
D)You can change the pointer as well as the value pointed by it
55 What is the output of this C code? A
int x = 0;
void main()
{
int *ptr = &x;
x++;
printf("%d\n", x);
printf("%d\n ", *ptr);
}
A)11 B)10 C)1 D)0
56 What is the output of this C code? C
void main()
{
int x = 0;
int *ptr = &5;
printf("%d\n", *ptr);
}
A)5 B)Address of 5 C)Compile time error
D)None
57 What is the output of this C code? C
void main()
{
int x;
int *ptr = &x;
printf("%d\n", *ptr);
getch();
}
A)0 B)1 C)Garbage value D)Address of x
58 Which of the following is the correct way of declaring a float pointer? B
A)float ptr B)float *ptr C)*float ptr D)None
59 Which header file should be included to use functions like malloc() and B
calloc()?
A)memory.h B)stdlib.h C)stdio.h D)dos.h
60 What function should be used to free the memory allocated by calloc() ? C
A)dealloc() B)realloc() C)free() D)malloc()
MODULE 5
76 Memory for a structure is allocated at the time of B
A)structure definition B)structure variable declaration
C)structure declaration D)function declaration
77 What is the similarity between a structure, union and enumeration B
A)To define new values B)To define new data types
C)To define new pointers D)To define new structures
78 Which operator connects the structure variable to its member name? C
A). B)-> C) Both A and B D)None
79 Which of the following cannot be a structure member? A
A)Function B)Another structure C) Array D) None
80 The size of a union is determined by size of _____________? C
A) The first member in the union B)The sum of the sizes of all member
C)The biggest member in the union D. The last member in the union
81 What would be the size of the following union declaration? C
union utemp
{
double a;
int b[10];
char c;
}u;
A)4 B)8 C)40 D)80
82 Members of a union are accessed as_____________. C
A)Unionvariable.member B) Unionpointervariable->member
C)bothA&B D) None
83 Which of the following share a similarity in syntax? B
1)union 2)structure 3)arrays 4)pointers
A)3&4 B)1&2 C)1&3 D)1,3&4