By default, which type of heap is being used by priority_queue<int> in c++ stl ?
Why we use the “dynamic_cast” type conversion?
What will be the Output of the Following Code?
int main()
{
string s="abc";
if(s == "abc"){
cout<<"pass";
}
else{
cout<<"Fail";
}
return 0;
}
What is the output of the following C program?
#include <stdio.h>
int main()
{
int x = 5;
int y = 10;
int z = x * y;
if (z > 20) {
printf("%d", z);
} else {
printf("%d", x + y);
}
return 0;
}
What is the output of the following code?
#include<iostream>
using namespace std;
int main() {
bool a = 1;
for (a = 1; a <= 5; ++a)
{
printf("%d", a);
}
return 0;
}
What is the main purpose of the "main" function in a C programming language?
EXAMPLE:
int main()
{
printf("Hello, World!");
return 0;
}
Which of the following statements presents the accurate syntax for declaring a function in the C programming language?
What is the output of the following C program?
#include <stdio.h>
int main()
{
int i, j;
for (i = 1; i <= 5; i++) {
for (j = 1; j <= 5; j++) {
if (i + j == 6) {
printf("%d, %d\n", i, j);
}
}
}
return 0;
}
What is the output of the code ?
Input :-
n = 7
[6 3 2 7 1 8 3]
#include <bits/stdc++.h>
using namespace std;
int main()
{
stack<int>st;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
while(!st.empty() && st.top()>a)
{
st.pop();
}
st.push(a);
}
while(!st.empty())
{
cout<<st.top()<<" ";
st.pop();
}
}
What is the output of the following code ?
#include <bits/stdc++.h>
using namespace std;
int main()
{
set<int>st({4,3,7,2,8});
for(auto it : st)
{
cout<<it<<" ";
}
cout<<endl;
auto ind=st.lower_bound(1);
cout<<(*ind)<<endl;
st.erase(ind);
for(auto it : st)
{
cout<<it<<" ";
}
cout<<(*st.begin())<<endl;
}