Skip to main content

CS201 Current Midterm Paper Fall 2013 Questions Answers



using namespace std;

int main() {

int a[6]={2,1,3,15,20,50};
int i=++a[1];
int j=a[1]++;
int k=a[i++];
int l=a[--i]*i;
int m=a[++i]-1;
couti" "j" "k" "l" "m" ";

    return 0;
}
output
3  2  3  6  14

2. Bitwise operators to mention
&  =bitwise AND operator
 | =btwise OR operator
    ^ =bitwise Exclusive OR operator
   ~ =bitwise NOT operator
3. 
int A[5] = {1 , 2, 3, 4};
int i;
for (i=0; i<5; i++)
{
A[i] = 2*A[i];
Cout<< A[i] " ";
}
output
2   4   6   8   118
4.
What will be the output of the following; (5 marks)
void main()
{
union Num
{
int ValueI;
float ValueF;
double ValueD;
char ValueC;
};

Num TestVal = {100};
cout"Integer =" TestVal.ValueIendl;
TestVal.ValueF = 2.123;
cout "Float=" TestVal.ValueFendl;
cout"Uninitialzed double =" TestVal.ValueD endl;
cout"Some rubbish???"endl;
TestVal.ValueC = 'U';
cout"character=" TestVal.ValueCendl;
}
output
Integer = 100
Float= 2.123
Uninitializad double 5.30754e-315
Some rubbish???
Character = U
5.
#include <iostream.h>
main ()
{
int y[10] = {10,20,30,40,50,60,70,80,90,100};
int *yptr, i;
yptr = y;
cout*(yptr+1*2)endl;
}
output
30


    Q) what will be the Out put of
    int x=10;
    int y=30;
    int *xptr;
    xptr=&x;
    cout "x = " *xptr+x ; (Out put signs are present but cant write here )
   Answer:   x=20
Q))When a pointer is incremented then how many bytes will it move to change its address?  Ans:When a pointer is incremented, it actually jumps the number of memory addresses
►According to data type (Pg 160)
“If an integer occupies four bytes in the memory, then the yptr++; will increment its value by four. when we increment the yptr, it
points to the next integer in the memory”
It depends on the data type of the size. *ptr++ this pointer will point to the next element in the array.
  Q 3 : If ( char array [7], is a character array then write a char at fifth loction of this array.
char[4]=’a’;


Q 4 : Which function is used in  read & write while handling file.

ifstream inFile; // object for reading from a file
ofstream outFile; // object for writing to a file
1:intPtr  is  a  constant pointer to integer  155
int *const  intPtr= &x;
       2:intPtr  is  a  pointer  to  constant 
const  int *intPtr = &x;
q3:  Char  name []= " Hello  World";   
    size  of  array name ?
ans :12  including space and NULL character
double atof (const char *nptr)
Answer: page 191
Converts the string nPtr to double.
char *strcpy (char *s1,const char *s2)
Answer: page 192
Copies string s2 into character array s1. The value of s1 is returned.


q5  tel  the size  of  initialized  array
int  arr []={0,0,0,0}
ans: 4
--We are trying to open a txt file which does not exist with command (“myfile.txt”, ios::out);  (2 marks)
 Ofstream.out;
Out.open(“myfile.txt”, ios::out);
If(!out) { cout<<”not found”; exit(1);}
A new file will be created and now we have to add our data in this file.

---A two-dimensional array has 2 rows and 3 columns. Write down the syntax to initialize first element of all rows of two-dimensional array with value 3 (2 marks)
int num[2] [3] ;
num[0] [0] =3;
num[1] [0]=3 ;
num[2] [0]=3 ;

Q)) When a pointer is incremented,what happens in the following cases?page#172
a)single-dimensional array
b)two –dimensional array 3

Comments

Popular posts from this blog

CS614 Quiz No.4 Shared by Abdul_Mateen (Solved)

Question # 1 of 10 ( Start time: 01:03:34 PM ) Total Marks: 1 The first step of the “12-steps data warehouse implementation approach” of Shaku Atre is: Select correct option: Finding user needs (Page No. 336) Planning system resources Finding system scope Data acquisition and cleansing Question # 2 of 10 ( Start time: 01:04:15 PM ) Total Marks: 1 Users do not care, how advance the front end of your DWH is, what they care is that: Select correct option: Tables should be properly denormalized Proper partitioning technique should be used At least star or snow flake schema should be implemented They should get information in timely manner and the way they want   Question # 3 of 10 ( Start time: 01:04:49 PM ) Total Marks: 1 Which of the following is NOT one of the top-10 mistakes that should be avoided during DWH development? Select correct option: Not interacting directly with end user Not being an accommodating person (Page No. 316) Isolating IT support p...

CS614 Quiz No.3 Shared by Sweety (Solved)

Question # 1 of 10 ( Start time: 09:48:28 PM ) Total Marks: 1 Mining multi dimensional databases allow users to: Select correct option: Categorize the data Analyze the data Summarize the data All of the given options   (Correct) Question # 2 of 10 ( Start time: 09:49:23 PM ) Total Marks: 1 As per Bill Inmon, a data warehouse, in contrast with classical applications is: Select correct option: Data driven   (Correct) Resource driven Requirement driven Time sensitive Question # 3 of 10 ( Start time: 09:50:11 PM ) Total Marks: 1 In ________learning you don’t know the number of clusters and no idea about their attributes. Select correct option: Supervised learning Unsupervised learning   (Correct) Multi Dimension modeling None of the given options Question # 4 of 10 ( Start time: 09:51:04 PM ) Total Marks: 1 Identify the TRUE statement: Select correct option: The data value increases as volume decreases   (Correct) The data value decreases ...

CS614 Quiz No.1 Shared by Manzar (UnSolved)

Question # 1 of 10 ( Start time: 03:35:24 PM )   Total Marks: 1 MDX by Microsoft is an example of _______ Select correct option: HOLAP DOLAP ROLAP None of the given options Question # 2 of 10 ( Start time: 03:36:40 PM )   Total Marks: 1 In decision support system ease of use is achieved by: Select correct option: Normalization Denormalization Drill up Drill down Question # 3 of 10 ( Start time: 03:38:07 PM )   Total Marks: 1 Which of the denormalization technique squeezes master table into detail? Select correct option: Pre-joining Horizontal splitting Vertical splitting Adding redundant column Question # 4 of 10 ( Start time: 03:38:28 PM )   Total Marks: 1 The trade-offs of denormalization is/are: Select correct option: Storage Performance Ease-of-use All of the given options Question # 5 of 10 ( Start time: 03:38:46 PM )   Total Marks: 1 ________is usually deployed when expressions can be used to group data together in...