Why are the combined data from all the class members more meaningful than your results alone?
The combined data from all class members provides a broader and more representative view of the research topic, capturing diverse perspectives and experiences that one individual's results may overlook. This collective data can reveal patterns and trends that strengthen the overall findings, enhancing validity and reliability. Furthermore, it allows for more robust statistical analyses and can lead to more comprehensive conclusions, ultimately enriching the learning experience for everyone involved.
What is a recursive call. Which data structure is used in it?
Stack. Because of its LIFO (Last In First Out) property it remembers its 'caller' so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.
Is the double a modifier in c plus plus?
A double is a floating point type, greater than or equal in size to a float.
Write a C plus plus Program to find the length of the string using pointer?
// to find the length of the string by using array
#include<stdio.h>
#include<string.h>
int main()
{
int i=0,len[21],n;
char str[8][11];
printf("no of name to be enter");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the %d string : ",i);
scanf("%s",str[i]);
}
for(i=0;i<n;i++)
{
len[i]=strlen(str[i])-1;
}
for(i=0;i<n;i++)
{
printf("\n lenght of %d string are ",i);
printf("%d",len[i]);
}
return(0);
}
What are the limitations of friend function in c plus plus?
Only that they cannot be inherited by derived classes. This is "a good thing". Other than that, a friend function has full access to a class' private and protected members and you cannot limit its scope. At this data hiding feature of c++ is broken.
Write a C plus plus program to read two integers and display them Use cin and cout statements?
#include
#include
void main()
{
int a,b;
clrscr();
printf("Enter two numbers: ");
scanf("%d%d",&a,&b);
printf("Multiplication of %d and %d is = %d ",a,b,a*b);
getch();
}
What is the Operator c plus plus?
c++ is not an operator, it is a programming language (the successor to the c programming language upon which it was based). However, if c were really an object or variable name, then ++ would be the postfix increment operator. c++ returns the value of c before incrementing c. Its counterpart, ++c, invokes the the prefix increment operator, which returns the value of c after incrementing.
++c is a convenient shorthand notation for c=c+1, which can also be written c+=1, all of which return the value of c after incrementing. c++ is also a convenient shorthand for c=c+1 or c+=1, but the return value is the original value of c, not the incremented value.
How do you calculate cgpa using c plus plus program?
#include <stdio.h>
void main()
{
int num,num1,num2, cal;
num=cal=0;
char grade1=cal=0,grade2=cal=0;
printf("\n Enter the number of subjects taken in Spring Semester:");
scanf("%d", &num);
fflush(stdin);//
if(grade1==4){
printf("\n\nEnter the Math Grade(A,B,C): %c",grade1);
do{
printf("\ngrade1=");
scanf("%d",&cal);
}
else if(
printf("\nError!\n\n");
}while(1);
printf("\nEnter the Math Credit hours(1~3):");
num1 = getchar();
grade1=4;
}
else if(grade2==3){
grade2=3;
}
printf("\nEnter the Math Grade(A,B,C):\n");
scanf("%c",&grade1);
printf("Enter the Physics Grade(A,B,C):");
grade2 = getchar();
printf("\nEnter the Physics Credit hours(1~3):");
num2 = getchar();
printf("\nMath Credit hours: %d",num1);
printf("\nPhysics Grade: %c",grade2);
printf("\nPhysics Credit hours:%d\n",num2);
printf("\n <Math Credit hours> \n");
do{
printf("\n 1 + 1 = ");
scanf("%d", &cal);
}while(cal != 3);
printf("\n Error!\n\n");
}
printf("\n <Physics Credit hours> \n");
do{
printf("\n 4 - 1 = ");
scanf("%d", &cal);
}while(cal != 3);
printf("\n Error!\n");
}
printf("\n The End.\n");
system("pause");
}
What is the storage allocation and scope of global extern static local and register variables?
Nooo Nooo
Static variable will be stored in .BSS segment... (Block Started By Symbol)
Where string arrays belong in a C program?
There is no data type string in C. String is handled as an array of characters. To identify the end of the string, a null character is put. This is called a null terminated character array. So array of strings will be a double dimensioned array of chars. It is implemented as an array of pointers, each pointer pointing to an array of chars.
What is a static binding c plus plus?
In its simplest definition, "binding", when referred to in the context of any computer programming language, describes how a variable is created and used (or "bound") by and within the given program and, possibly, by other programs, as well. However, there are other definitions for "binding" in computer programming languages, which would take too long to list and explain, especially given the broad nature of the question.
What are the different features of c plus plus?
C++ features a fundamental shift away from the structured programming principles of C. It introduces Object-Oriented-Programming(OOP) to the C language. However, C++ is a wholly new language, even though it is not fully object-oriented like Java and Smalltalk. C++ lets the user choose to program in the paradigm of his choice, but it is obviously advantageous to program in OOP, since it is more equipped to tackle real-world and complex problems. Also, code done using OOP can be more easily maintained, debugged, scaled and distributed. Other advantages of C++ are that it adds even more class-libraries to C. The header files of C++ also provide more built-in functions. On the whole, C++ syntax is also much more cleaned up than C, particularly in console I/O, structures and pointers.
What are the arithmetic and logical operator?
AND, OR, and NOT are the most common ones. There are others, too, such as XOR.
AND, OR, and NOT are the most common ones. There are others, too, such as XOR.
AND, OR, and NOT are the most common ones. There are others, too, such as XOR.
AND, OR, and NOT are the most common ones. There are others, too, such as XOR.
Can you add images in c plus plus?
C++ is designed to be as generic as possible. As such, printing is text-mode only, just as the console is designed for text-mode only. There are no graphics routines in the standard library. To gain graphics output, including image printing, you need an API and library for your specific platform and hardware.
How do you find the product of 2 matrices in C plus plus?
To multiply two matrices, the matrices must support the dot product format. That is, given the multiplication of matrices A * B = C, the dimensions of each array must be A[x][y], B[y][z] and C[x][z]. Note that the number of columns in A must be the same as the number of rows in B.
To calculate the results of elements in C, you are effectively summing the products of corresponding elements in a row of A and a column of B, hence there must be as many columns in A as there are rows in B.
This method of multiplication may seem odd at first, however let's begin with a simple example. Imagine you have a matrix containing the prices for a range of products:
Apple: 30p
Banana: 25p
Orange: 29p
This matrix would normally be represented as a one-dimensional array with three elements.
double A[3] {0.3, 0.25, 0.29};
But as a matrix, it is a two-dimensional array with one row:
double A[1][3] {{0.3, 0.25, 0.29}};
Now imagine you have another array that contains the daily sales quantities for each product:
Day: M T W T F S S
Apple: 5 6 4 3 8 6 7
Banana: 6 9 5 7 3 5 4
Orange: 7 9 4 7 3 5 6
This would be represented as a two dimensional array with three rows and seven columns:
size_t B[3][7] {{5, 6, 4, 3, 8, 6, 7},{6, 9, 5, 7, 3, 5, 4},{7, 9, 4, 7, 3, 5, 6}};
What you want is the total sales value of each day. Thus the total sales for Monday would be (0.3*5) + (0.25*6) + (0.29*7). Repeating this for the remaining days would reveal a one-dimensional array of 7 elements. But as a matrix, it is a two-dimensional array with just one row. Thus we have the following array declarations:
double A[1][3] {{0.3, 0.25, 0.29}};
size_t B[3][7] {{5, 6, 4, 3, 8, 6, 7},{6, 9, 5, 7, 3, 5, 4},{7, 9, 4, 7, 3, 5, 6}};
double C[1][7] {};
Where; x=1, y=3 and z=7.
To work out the totals, you need three nested loops:
for (size_t x=0; x!=1; ++x)
{
for (size_t z=0; z!=7; ++z)
{
for (size_t y=0; y!=3; ++y)
{
c[x][z] += a[x][y] * b[y][z];
}
}
}
Note the order of the loops: x, z and y (not x, y and z).
Now let's see a working example of this:
#include<iostream>
#include<random>
#include<time.h>
template<typename T>
void print_matrix (const T& a, const size_t rows, const size_t cols)
{
for (size_t r=0; r!=rows; ++r)
{
for (size_t c=0; c!=cols; ++c)
{
std::cout << a[r][c] << '\t';
}
std::cout << std::endl;
}
std::cout << std::endl;
}
int main()
{
double a[1][3] {{0.3, 0.25, 0.29}};
size_t b[3][7] {{5, 6, 4, 3, 8, 6, 7},{6, 9, 5, 7, 3, 5, 4},{7, 9, 4, 7, 3, 5, 6}};
double c[1][7] {};
for (size_t x=0; x!=1; ++x)
{
for (size_t z=0; z!=7; ++z)
{
for (size_t y=0; y!=3; ++y)
{
c[x][z] += a[x][y] * b[y][z];
}
}
}
std::cout << "\nProduct prices:\nApples\tOranges\tBananas\n"; print_matrix (a,1,3);
std::cout << "\nWeekly sales:\nMon\tTue\tWed\tThu\tFri\tSat\tSun\n"; print_matrix (b,3,7);
std::cout << "\nTotal sales:\nMon\tTue\tWed\tThu\tFri\tSat\tSun\n"; print_matrix (c,1,7);
}
Output:
Product prices:
Apples Oranges Bananas
0.3 0.25 0.29
Weekly sales:
Mon Tue Wed Thu Fri Sat Sun
5 6 4 3 8 6 7
6 9 5 7 3 5 4
7 9 4 7 3 5 6
Total sales:
Mon Tue Wed Thu Fri Sat Sun
5.03 6.66 3.61 4.68 4.02 4.5 4.84
List and explain bitwise operators in C language?
void main()
{
unsigned int word1 = 077u, word2 = 0150u, word3 = 0210u;
printf ("%o ", word1 & word2);
printf ("%o ", word1 & word1);
printf ("%o ", word1 & word2 & word3);
printf ("%o\n", word1 & 1);
getch();
}
What are proxy classes in c plus plus?
A proxy is defined as any entity that acts on behalf of another entity. For instance, a proxy server is a server that you use to make network calls on your behalf. The proxy server effectively hides your identity from the network because the network only sees the proxy server.
A proxy class is a similar concept -- it is simply a class that acts on behalf of another class. Proxy classes are typically used to simplify the interface to a larger, more complex object.
Note that this is not the same as deriving one object from another. Although you can achieve the same sort of thing with derivation, a proxy class contains a member pointer to the class it acts upon, it does not derive from it. Thus it is free to override the class behaviour, but does not inherit any of its underlying complexity.
"Wrapper" classes are a form of proxy. They contain a class member pointer but they expose a limited or simplified interface to that class member, making more complex calls to that class on your behalf.
Proxy classes can also be used as a reference counting mechanism. Rather than having multiple copies of the same complex object, you can have several lightweight proxy classes all pointing to a single instance of an object, each of which acts on its behalf. Copying lightweight objects does not copy the original object, thus reducing the memory footprint of that object, and when all the lightweight classes finally fall from scope, the original object also falls from scope.
Why you use hash in c plus plus?
#define is a pre-compiler directive which is used to define a macro. All occurrences of the defined macro within your source code are replaced by the macro definition prior to compilation. In other words, your code is altered to produce an intermediate file which is actually compiled, just as if you'd copy/pasted the macro definition throughout your code. However, the end result is that the compiler cannot identify any problems within your macros since they will no longer exist in the intermediate file. Macros are not type safe, thus they are generally frowned upon, especially when they are used to define complex functions. However, correct usage of macros can greatly simplify your code and ultimately permit the compiler to build different versions of your code, depending upon which definitions you define. For instance, you will typically use slightly different versions of some functions depending on whether you are building a debug or release version of your code, and will typically #define DEBUG for debug builds. You can also cater for cross-platform coding by filtering platform-specific functions using macro definitions. You alter the type of the build simply by defining the appropriate definitions, either within the code itself (using #define), or via the compiler's pre-processing command line switches, or a makefile script.
FUNCTION OVERLOADING:
- when we define two functions with same name,in same class(may be) distinguished by their signatures
- resolved at compile time
- same method bt different parameters in each of them
FUNCTION OVERRIDING:
- when we redifine a function which is already defined in parent class
- resolved at run time
- changing the existing method
How is garbage collection done in c plus plus?
Garbage collection is used to released resources which were previously used by the application(s) which is called garbage collector. Garbage collection allows to prevent memory leaks which are the main problem of old style of programming.
C plus plus program for overloading operator?
#include<iostream>
#include<string>
// a simple class
class my_class
{
private:
std::string m_caption;
public:
// default constructor
my_class (std::string caption): m_caption (caption) {}
// read-only accessor
const std::string& get_caption() const { return m_caption; }
};
// output stream insertion operator overload
std::ostream& operator<< (std::ostream& os, const my_class& obj)
{
os << obj.get_caption();
return os;
}
int main()
{
// call default constructor
my_class object1 ("This is the caption for object1");
// exercise output stream insertion operator overload
std::cout << object1 << std::endl;
}
How do you learn the c plus plus language?
The same way you understand any computer language -- by learning the language. However, the learning curve is steep so it helps if you learn a much simpler language first, such as BASIC, so that you are familiar with basic concepts such as variables, arrays, loops and so on.
Where you can include a header file in the program?
You can include a file with the #include directive at any place you want to. You just have to consider that the compiler will see the total source file as if you had copied the contents of each include file at the point where you included it, and it will parse and process the total source file accordingly.
That said, header files, a subset of included files, are generally #include'd at the top of the source file. Again, it all depends on what is in the include file.
What are 5 different types of modifiers in c plus plus?
There are five type modifiers in C++:
long
short
signed
unsigned
[] - the array subscript
The first four are used solely to modify the characteristics of the int type. Signed and unsigned can also be applied to the char and wchar_t types while long can also be applied to a double. If no type is specified, int is assumed. The array subscript modifier can be applied to any type including modified types and pointers to a type.
Excluding arrays, pointers and the built-in bool type, C++ has the following fundamental (built-in) types:
char
signed char
unsigned char
wchar_t
signed wchar_t
unsigned wchar_t
int
signed int
unsigned int
short int
signed short int
unsigned short int
long int
signed long int
unsigned long int
long long int
signed long long int
unsigned long long int
float
double
long double
A plain (unmodified) char may be signed or unsigned (implementation defined) but must behave exactly as an explicitly signed or unsigned char would. However, all three are deemed separate types in C++. Similarly with wchart_t. However, an int is implicitly signed.
The length of each fundamental type is implementation defined, but can be found by using the sizeof operator either upon the type itself or upon an instance of the type. The standard library <type_traits> header can be used to determine other information, particularly useful in static (compile-time) assertions.
The C++ standard library also provides additional types of specific size, including int8_t, int16_t, int_32_t, int64_t, uint_8_t, uint_16_t, uint32_t and uint64_t. Note that the _t suffix is often used to denote that a type is really a typedef (an alias) for a modified type, such as size_t (an unsigned int). However wchar_t is typically implemented as a built-in type. All fundamental types can be found in <cstddef> (which is usually included when you include any standard library header such as <iostream>) while the fixed-length integers can all be found in <cstdint>.