Evaluate the following expression:
(false && true) || false || true
#include
What is the output of the following C program?
int main()
{
int *m, n[10];
scanf("%d%d",&m,&n); //m=1, n=2
printf("%d %d", m,n);
}
What is the output of the following C++ code?
int main()
{
int c=0;
if (c++)
{
c++;
}
else
{
c--;
}
cout << c;
}
What is the difference between the length() and size() methods for strings?
What will be the output of the following C code?
main()
{
int a = 100, *b, **c, ***d;
b = &a; c = &b; d = &c;
printf("%d %d %d %d", a, *b, **c, ***d);
}
What is the output of the program given below?
#include <stdio.h>
int p=30;
int main()
{
int p = p;
printf("%d",p);
return 0;
}
What will be the output of the following C code?
void main()
{
int i=0;
while(i++<10)
{
if(i<5 && i<9)
continue;
printf("\n%d\t",i);
}
}
#include <iostream>
using namespace std;
class MyClass {
int x;
public:
MyClass(int val) : x(val) {}
const int& get() const {return x;}
};
void print (const MyClass& arg) {
cout << arg.get() << '\n';
}
int main() {
MyClass foo (10);
print(foo);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int compareints (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int values[] = { 50, 20, 60, 40, 10, 30 };
int main ()
{
int * p;
int key = 40;
qsort(values, 6, sizeof (int), compareints);
p = (int*) bsearch (&key, values, 6, sizeof (int), compareints);
if (p != NULL)
printf ("%d\n",*p);
return 0;
}