मराठी

Int Toy(int n) { return (n<=0)? 1: n%10 + Toy(n/10); } With reference to the program code given above, what will the function Toy() return when the value of n = 56? - Computer Science (Theory)

Advertisements
Advertisements

प्रश्न

int Toy(int n)
{ return (n<=0)? 1: n%10 + Toy(n/10); }

With reference to the program code given above, what will the function Toy() return when the value of n = 56?

पर्याय

  • 65

  • 12

  • 651

  • 11

MCQ

उत्तर

12

shaalaa.com
Structured Data Types - Arrays (Single and Multi-dimensional), Strings
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2021-2022 (April) Set 1

संबंधित प्रश्‍न

An array ARR [ -5 .....15, 10.....20] stores elements in Row Major Wise with each element requiring 2 bytes of storage. Find the address of ARR [10] [15] when the base address is 2500.


Assertion: In Java, the String class is used to create and manipulate strings, and it is immutable.

Reason: Immutability ensures that once a String object is created, its value cannot be changed.


Given are two strings, input string and a mask string that remove all the characters of the mask string from the original string.

Example: INPUT: ORIGINALSTRING: communication
    MASK STRING: mont
  OUTPUT: cuicai  

A class StringOp is defined as follows to perform above operation.

Some of the members of the class are given below:

Class name StringOp
Data members/instance variables:
str to store the original string
msk to store the mask string
nstr to store the resultant string
Methods / Member functions:
StringOp() default constructor to initialize the data member with legal initial value
void accept( ) to accept the original string str and the mask string msk in lower case
void form() to form the new string nstr after removal of characters present in mask from the original string
void display( ) to display the original string and the newly formed string nstr

Specify the class StringOp giving details of the constructor( ), void accept( ), void form() and void display( ). Define a main( ) function to create an object and call all the functions accordingly to enable the task.


A class Mixarray contains an array of integer elements along with its capacity (More than or equal to 3). Using the following description, form a new array of integers which will contain only the first 3 elements of the two different arrays one after another.

Example:

Array1: { 78, 90, 100, 45, 67 }

Array2: {10, 67, 200, 90 }

Resultant Array: { 78, 90, 100, 10, 67, 200}

The details of the members of the class are given below:

Class name Mixarray
Data members/instance variables:
arr[] integer array
cap integer to store the capacity of the array
Member functions/methods:
Mixarray (int mm ) to initialize the capacity of the array cap=mm
void input( ) to accept the elements of the array
Mixarray mix(Mixarray P, Mixarray Q) returns the resultant array having the first 3 elements of the array of objects P and Q
void display( ) to display the array with an appropriate message.

Specify the class Mixarraygiving details of the constructor(int), void input( ), Mixarray mix(Mixarray,Mixarray) and void display( ). Define a main( ) function to create objects and call all the functions accordingly to enable the task.


Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×