Predict the output of following C++ program in cpp

 

 Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  Predict the output of following C++ program in cpp .So let’s go to our topic

#include<iostream>
using namespace std;
class Test
{
static int i;
int j;
};
int Test::i;
int main()
{
cout << sizeof(Test);
return 0;
}

Assume that integers take 4 bytes.

Output:
4 (size of integer)
static data members do not contribute in size of an object. So ‘i’ is not considered in size
of Test. Also, all functions (static and non-static both) do not contribute in size.

Related Post:-

Predict the output of following C++ program in cpp

Print 1 to 100 in C++, without loop and recursion

Factorial Using Loop Example Program In C++

bfs algorithm in data structure (BFS)

if..else Statement Example Program In C++

For Loop Example Program In C++

Program to find the sum of each row & column of a matrix of size n x m andif matrix is square, find the sum of the diagonals also.

 tudo app using html and css javascript

how to create age calculator in html project

how to make toast in html css and javascript

how to make copy to clipboard in javascript

how to create email validation in javascript

So I hope that you learn about the  Predict the output of following C++ program in cpp And if you have any more queries about computer relegated then feel free to discuss your problem in the comment section.Thank you so much and come back for more updates about Techgsr.co .

How to write program convert temperatures from Celsius to Fahrenheit and vice versa

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  How to write program convert temperatures from Celsius to Fahrenheit and vice versa .So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); int choice; float ctemp,ftemp; cout << “1.Celsius to Fahrenheit” << endl; cout << … Read more

how to write program in cpp find the sum of either of the diagonals of a 4 x 4 matrix

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write program in cpp find the sum of either of the diagonals of a 4 x 4 matrix .So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); int x; int A[4][4],sum=0; //Reading the matrix. … Read more

how to wirte in cpp Program to print the first 10 lines of pascal’s triangle

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to wirte in cpp Program to print the first 10 lines of pascal’s triangle .So let’s go to our topic #include <iostream.h> #include <conio.h> #include <iomanip.h> long triangle(int x,int y); int main() { clrscr(); const lines=10; for (int i=0;i<lines;i++) for … Read more

how to write program enter a sentence and output the number ofuppercase & lowercase consonants, uppercase & lowercase vowels in sentence.

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write program enter a sentence and output the number ofuppercase & lowercase consonants, uppercase & lowercase vowels in sentence.So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); char line[80]; int number_of_vowels,uc,lc,uv,lv; uc=lc=uv=lv=0; cout … Read more

how to write Program to identify if an input is a symbol, digit or character

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about  how to write Program to identify if an input is a symbol, digit or character .So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); char charac; cout << “Enter your input : ” << endl; … Read more

how to write Program to find the sum of each row & column of a matrix of size n x m andif matrix is square, find the sum of the diagonals also.

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write Program to find the sum of each row & column of a matrix of size n x m andif matrix is square, find the sum of the diagonals also. .So let’s go to our topic #include <iostream.h> #include … Read more

how to write Program to count the number of words and characters in a sentence

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write Program to count the number of words and characters in a sentence .So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); int countch=0; int countwd=1; cout << “Enter your sentence in lowercase: ” … Read more

how to write Program to enter an integer and output it in the reversed form

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write Program to enter an integer and output it in the reversed form .So let’s go to our topic #include <iostream.h> #include <conio.h> void main() { clrscr(); long int num1,num2,rnum=0; cout << “Enter an integer : ” << … Read more