The C statement with the 'extern' keyword is a:
#include
What is the output of the following C code?
int main()
{
int a=0;
a=4+4/2*5+20;
printf("%d",a);
return 0;
}
What will be the output of the following C code?
void main()
{
char a[] = "12345\0";
int i = strlen(a);
printf("here in 3 %d\n",++i);
}
What is a compiler-compiler?
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void mani()
void mani()
{
cout<<"hai";
}
int main()
{
mani();
return 0;
}
What happens if the following program is executed in C and C++?
#include <stdio.h>
void main()
{
printf("Hello World");
}
In the program below, if the first string is entered as 'GOOD' and the second as 'MORNING', what will be the expected output?
int main()
{
char str1[25], str2[50];
cout << "\n enter first string\n";
cin.getline(str1, 25);
cout << "\n enter second string\n";
cin.getline(str2, 25);
strcat(str2, str1);
int len = strlen(str2);
cout.write(str2, len);
return 0;
}
What will be the output of the following C++ code?
class complex{
double re;
double im;
public:
complex() : re(1), im(0.5){}
bool operator==(complex &rhs);
operator int(){}
};
bool complex::operator == (complex &rhs){
if((this->re == rhs.re) && (this->im == rhs.im))
return true;
else
return false;
}
int main(){
complex c1;
cout << c1;
}
Below is the code for for printing the frequency of each element of an array:
#include <bits/stdc++.h>
using namespace std;
int main() {
map<int,int> mp;
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
mp[arr[i]]++;
}
for(auto it=mp.begin();it!=mp.end();it++){
cout<<it->first<<" "<<it->second<<"\n";
}
return 0;
}
What is the time complexity?