@vivek,, No it luks lik that, but u hav to do the same with last row 1's...(just like first row 1's in my answer)
1. char ch;
cin.get(ch).get(ch);//How this statement is valid??-2 get() func.
2."this" pointer, random()function // Is it there in the CBSE syllabus
3.pls. illustrate (pls give eg.)scanf and printf statements(especially
for outputs)
4.Give output-
void main()
{
int x[]={10,20,30,40,50};
int *p, **q, *t;
p=x;
t=x+1;
q=&t;
cout<<*p<<","<<**q<<","<<*t++;
}
5. How to detect end of file without using eof() function.
6.Give the ouput and explain
#include<iostream.h>
void main()
{
int a =32, *ptr=&a;
char ch='A' , &cho=ch;
cho+=a; *ptr+=ch;
cout<<a<<" "<<ch<<endl;
}
7.Convert the infix expression:
A-B+C*D^E*G/H into postfix expression. Evaluate the postfix expresstion showinf the status of stack at every step given
A=5, B=2,C=4,D=2,E=1,G=6,H=5;
//Atleast explain the use of exponential operator here..
8.Why Insertion sort is more efficient than other sorts?
-
UP 0 DOWN 0 0 42
42 Answers
and I am not sure of the random() function either
I think rand() was there in my time!
horizontal rollin is more efficient than vertical rollin??//sorry sir-this is just a guess, i donno the exact answer..
6th wala i am a bit confused myself..
i read it long back...now dont remember that one..
read this : http://www.cppreference.com/wiki/c/io/scanf
that will help you understand.
But in 6th value of a=32 is not changed then why will it give 129?
see ptr is attached to a,so if ptr changes by 97,so will a (ASCII code of 'a' =97)
('A' + a = 'A' + 32 = 'a')
7.Convert the infix expression:
A-B+C*D^E*G/H into postfix expression. Evaluate the postfix expresstion showinf the status of stack at every step given
A=5, B=2,C=4,D=2,E=1,G=6,H=5;
http://targetiit.com/iit_jee_forum/posts/infix_prefix_postfix_3561.html
read this one..
6) i ve a doubt whether assignment operators can b used fr characters.....
wow so many doubts in C++ ..... maybe i should also post some of mine but in free time..
btw let everyone say what they want to i would still say java is much better...(hehe u may say that angoor khatte hain wali baat but still..)
*p++ = *(p++)
sometimes it depends on compilers.. but I think it hsould be this...
To confirm just run a small prog on the compiler.. i dont have a c++ compiler installed
4.Give output-
void main()
{
int x[]={10,20,30,40,50};
int *p, **q, *t;
p=x;
t=x+1;
q=&t;
cout<<*p<<","<<**q<<","<<*t++;
}
*p=10
*t=20
*t++=30
**q=20
output will be
10,20,30
5. How to detect end of file without using eof() function.
by taking the size of the file and comparing it to the parsed length.. It is a very tedious and not so good method!
2. yes they are in syllabus
3.scanf and printf are like cin and cout . they are used under header file stdio.h
6. 32 A
neither..
i havent touched java
and C++ not after class xii
but i did one C course at kgp..
Sir but the output for 4th is given as 10, 30, 20.. Can u explain the *t++ statement... Wont the size of integer get incremented (ie to 30)??So even q's value will be same as t(ie 20), but in the output t gets inc to 30
Read infix post fix
http://scriptasylum.com/tutorials/infix_postfix/algorithms/infix-postfix/index.htm
It is written nicely
Dont mess this in the exam.. this is free ka marks
8.Why Insertion sort is more efficient than other sorts?
Do you know the method used in inserttion sort?
It ihas to do with the order of the program.. ie the number of steps needed to get that done.