VKS-LEARNING HUB

Home » Class-XI

Class-XI


45 Comments

    • vinsri76 says:

      since you have use ” before a
      variable name should not start with any special character
      it should

      a=43
      b=43
      c=a+b
      print c

  1. >>> import math
    >>> a=input(“enter degree”)
    enter degree30
    >>> b=math.cos(30)
    >>> c=(math.pi/180.00)*30.00
    >>> print c
    SyntaxError: invalid syntax
    >>>
    why does the system show syntax error ?
    it highlights c and declares it as invalid syntax

    • vinsri76 says:

      import math a=input(“enter degree”) b=math.cos(30) print “value of b= “,b c=(math.pi/180)*30 print “value of c= “,c

      output Python 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32 Type “copyright”, “credits” or “license()” for more information. >>> ================================ RESTART ================================ >>> enter degree30 value of b= 0.154251449888 value of c= 0.523598775598 >>> its working

    • vinsri76 says:

      import math
      a=input(“enter degree”)
      b=math.cos(30)
      print “value of b= “,b
      c=(math.pi/180)*30
      print “value of c= “,c

      output
      Python 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32
      Type “copyright”, “credits” or “license()” for more information.
      >>> ================================ RESTART ================================
      >>>
      enter degree30
      value of b= 0.154251449888
      value of c= 0.523598775598
      >>>

  2. Sir plzzzzz can u telll me that what is a constant
    Try to telll me as sooon as possssible

    • vinsri76 says:

      Constants
      A value which is hard coded into a program, which remains unchanged through out the program. Constants are of five (5) types:
      1. char constant: Character constant
      2. int constant: Integer constant
      3. float constant: Single precision floating point constant
      4. double constant Double precision floating point constant
      5. String constant
      Note: C++ does not support constant of the type void.

      Examples of C++ Constants are given below:
      Data Type Constants
      char ‘A’,’B’,’C’,…,’X’,’Y’,’Z’,’a’,’b’,’c’,…,’x’,’y’,’z”0′,’1′,…,’8′,’9′,’!’,’@’,’#’,’%’,’^’,’&’,’*’,’+’,…,’?’
      int 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, …, 2147483647,0, -1, -2, -3, -4, -5, -6, -7, -8, -9, …, -2147483648
      float/double 0.0, 15.75, 96.625, 1.25, 28.575, 2.3333, 0.69, 10.0,-25.8, -0.72, -154.85, -5.0, -759.625, -89.025, -7.2
      string “Amit”, “Pizza”, “India”, “Apple”, “G”, “9”, “$”, “e” “GH-14/12”, “23981535”, “20/10/2005”, “***”, “6.0”

  3. Sir can u giv the answer to 10th question of assssignment 1 it is not there in the answer key

    • vinsri76 says:

      Type modifiers are used to change default type of the built-in data types. Type modifiers supported by C++ are long, short, signed and unsigned. They generally change the storage (Memory Allocation) for fundamental Data Type.
      for Example
      Int generally required 4 bytes to Store Data but if use type modifer short int it required only 2 bytes

      Answer is also given in Sample Paper 2

  4. How gets is better than cin in terms of string …
    Explain with a example how to do dis now

    • vinsri76 says:

      cin is console input used to get the value from user and store to variable but does not allow space
      cin treats space as a separator . It required iostream.h header file
      gets() is also used to get the string value only from user and store it into variable but it does not
      treat space as separator so space is also get stored in string variable. it required stdio.h header file

      example

      void main()
      {
      char City[20];
      cout<>City;
      cout<<"Your City is :<<City;
      }
      let assume if user run this code and user input New Delhi at run time to store in variable City only New will be stored as cin treat space as sperator so cout statement will only New

      output
      Enter City: New Delhi
      Your City is : Delhi

      To input a string with space, we have to use function gets() from the header file stdio.h .

      void main()
      {
      char City[20];
      cout<<" Enter City:";
      gets(City);
      cout<<"Your City is :<<City;
      }
      let assume if user run this code and user input New Delhi at run time to store in variable City it will store complete string New Delhi Including space

      output
      Enter City: New Delhi
      Your City is : New Delhi

  5. Sir can u give some info about the ctype and is alpha and all that in short and what the values which they return…..
    Give some info about what is conditions for is isalpha and alll

    • vinsri76 says:

      Kindly reads the notes also.

      Functions from the header file

      Function Name Return Value Usage

      toupper(ch) int Convert a lowercase ch into uppercase
      tolower(ch) int Convert a uppercase ch into lowercase
      isupper(ch) int Checks if ch is uppercase
      islower(ch) int Checks if ch is lowercase
      isdigit(ch) int Checks if ch is digit
      isalpha(ch) int Checks if ch is alphabet (letter)
      isalnum(ch) int Checks if ch is either alphabet or digit

      Return value of functions isupper(), islower(), isdigit(), isalpha() and isalnum() vary from compiler to compiler. Table is given below showing return value of isupper(), islower(), isdigit(), isalpha() and isalnum() using Borland C++ compiler:

      Function Digit (ch) Uppercase (ch) Lowercase (ch) Special (ch)

      isupper(ch) 0 (False) 4 (True) 0 (False) 0 (False)
      islower(ch) 0 (False) 0 (False) 8 (True) 0 (False)
      isdigit(ch) 2 (True) 0 (False) 0 (False) 0 (False)
      isalpha(ch) 0 (False) 4 (True) 8 (True) 0 (False)
      isalnum(ch) 2 (True) 4 (True) 8 (True) 0 (False)

  6. Sir where is the holiday homework?

  7. Sir are all the notes posted on your site reqd. for scoring marks in tomorrows test?

  8. #include
    #include
    void main()
    {
    int a,b;
    cin>>a;
    cin>>b;
    int prod=a*b,r;
    while(r>0)
    {
    r=a%b;
    a=b;
    b=r;
    }
    cout<<"HCF"<<a<<endl;
    cout<<"LCM<<prod/a;
    getch();
    }

    Sir in this question….the output displayed is wrong
    for LCM ….a is shown
    for HCF……b is shown

    • vinsri76 says:

      in ur code while(r>0) will not run as r is not assigned any value before use
      For LCM and HCF we will use do while loop
      correct code

      //Program to find HCF and LCM of two integers
      #include
      #include
      void main()
      {
      int a, b;
      cout<>a;
      cout<>b;
      int prod=a*b, r;
      do
      {
      r=a%b;
      a=b;
      b=r;
      }
      while(r>0);
      cout<<"HCF="<<a<<endl;
      cout<<"LCM="<<(prod/a)<<endl;
      getch();
      }

  9. sir whats the difference between a = ’12’ and a = “12”? in a question they asked What is the type of each of these two constants?

  10. #include
    #include
    int checkpalindrome(int n);
    void main()
    {
    int n;
    cout<>n;
    int checkpalidrome(n);
    getch();
    }
    int checkpalindrome(int n)
    {
    int m=0,p=n,d;
    while(n!=0)
    {
    d=n%10;
    m=10*m+d;
    n=n/10;
    }
    return p==m;
    }

    Sir there is something wrong with this program as there is no output showing

    • vinsri76 says:

      #include #include int checkpalindrome(int n); void main() { int n,z; cout<>n; z=checkpalindrome(n); // in your code spelling of functon name was wrong and since the function in returning int value it must be storedin some variable if(z==1) cout<<"Palindrome"; else cout<<"not Palindrome"; getch(); } int checkpalindrome(int n) { int m=0,p=n,d; while(n!=0) { d=n%10; m=10*m+d; n=n/10; } return p==m; }

      ________________________________

  11. sir can you upload the solutions of the sample paper and the output practice questions for cross checking and help thank you

  12. sir and what about set 2

  13. Sir how do you write the code for a program that finds out if the number the user inputs is in the fibonacci sequence or not??

  14. Nikhil man mind your business I know what to do and when to do and I checked and it was not there when I checked it so better not to poke your noseanywhere and everywhere you like to

  15. And one more thing first check the sote for which you have asked the question it is always dere in his site……… So first check and den ask

  16. Btw sir do we have to do HCF AND LCM AND GENERATING FIVONACCI NUMBERS AND ALL STUFF

  17. Nikhil the is clawed tit for tat

  18. do while is not coming, is it??

  19. Sir what is wrong in this program?

    int n,f=1,d=2;
    cout<>n;

    while(d!=0&&f<n)
    { d=n%f;
    f++;
    }

    if(d!=0){
    cout<<"Number is a prime number"<<endl;
    }

    else if(d==0){
    cout<<"Number is a composite number"<<endl;
    }
    correct code
    #include
    void main()
    {
    int n;
    cin>>n;
    int k=2, prime=1;
    while (k<n && prime==1)
    {
    if (n%k==0)
    prime=0;
    k++;
    }
    if (prime==1)
    cout<<n<<" Prime Number"<<endl;
    else
    cout<<n<<" Composite Number"<<endl;
    }

    • vinsri76 says:

      #include
      void main()
      {
      }

      int n;
      cout<>n;
      int k=2, prime=1;
      while (k<n && prime==1)
      {
      if (n%k==0)
      prime=0;
      k++;
      }
      if (prime==1)
      cout<<n<<" Prime Number"<<endl;
      else
      cout<<n<<" Composite Number"<<endl;

  20. Jay Patel says:

    2. Write a complete C++ program to input n and generate following sequence of numbers …

    a) 1^2, 2^2, 3^2, 4^2, …, (n-1)^2, n^2

    • vinsri76 says:

      void main()
      {
      int n, sum=0;
      cout<>n;
      int x=1; //Initialisation of control variable
      while (x<=n) //Terminating Condition
      {
      cout<<x*x<<"," // will display above series
      sum+=x*x; // will also do sum of the above series
      x++; //Update of control variable
      }
      cout<<“Sum=”<<sum<<endl;
      }

  21. Het Shah says:

    Sir can u pls give full explaination for switch case
    As soon possible pls

Leave a comment