20 Mcqs
Question21:
Write the output of the following code segment: 2marks
intx[10]={0,1,2,3,4,5,6,7,8,9};
int*xptr;
xptr=&x[5];
cout<<*(xptr++)+1;
Question 22: 2marks
Write the syntax for closing a file "thisFile.txt" associated with the file handler my file.
Question 23: 3 marks
What is the output of following code snippet? 3marks
Int array[7], sum=0
For(int i=0; i<7;i++)
{
Array[i]=I;
Question 24: 5marks
If p and q are pointers to int and n is an int, which of the following are legal and which are the following are illegal statements? And why?
a.p+q
b.p-q
c.p+n
d.p-n
e.n-q
and 2 question more….
1.To Which category of the software "Compiler and Interpreter" belongs?
2.What is the result of the expression x = 2 + 3 * 4 – 4 / 2?
3-Which header file must be included while handling files?
4-What is meant by C++ statement: const int *ptr = &x;
5_what is the difference strcpy function and strncpy function?
6-write a program in which swaps two number without using third variable?
Hint:
bitwise operator use
mostly mcqs is related to identify error in the program
todays paper CS-201:
Q.1. write a C statement to store word "Pakistan" by using character array and by using character pointer seperately .
Q.2. write a program which takes input 5 integers from the user, stores them in an array and by using pointer airthmatic displays thier squares on the screen. i.e if the 5 integers are 1, 2, 3, 4, 5, the output should be 1, 4, 9, 16, 25 .
Q.3. write a C statement for a structure Inventory, having 3 elements namely stock, price, quantity.
Q.4. Trace out the mistakes in the given code (if any), correct it and give reason
main{ }
{
int x = 10;
const int *ptr = &x;
*ptr = 5;
cout << ptr;
}
Q.5. write a c statement for a structure of a triangle having 3 elements namely base, altitude and hypoteneus.
0 comments
Post a Comment