ANSWERS WITH COMPLETE SOLUTIONS VERIFIED
LATEST UPDATE
Features of the functional paradigm includes
expresses computations in terms of mathematical functions & simpler semantics
Compilation of a program is the translation of all statements of a program into
assembly language before any statement is executed.
True
A programming language can belong to multiple paradigms
True
Features of the imperative or procedural paradigm includes
conditional statements & manipulation of named data (variables)
What is the output of the following code
#include <stdio.h>
void main() {
char a[10][5] = {"hi", "hello", "fellows"};
printf("%d", sizeof(a[2]));
}
5
What is printed by the following program?
#include <stdio.h>
void fun(int x) {
if (x>0) {
,printf("%d", x);
fun(x-1);
printf("%d", x);
} else {
printf("@");
}
}
int main() {
fun(5);
}
54321@12345
Assume that a string is declared as
char str[ ] = "heLLo";
What is the return value of sizeof(str) ?
6
What is printed by this program?
#include <iostream>
using namespace std;
class A {
public:
void m() {cout << "AAA";}
};
class B: public A {
public:
virtual void m() {cout << "BBB";}
};
class C: public B {
, public:
void m() {cout << "CCC";}
};
int main() {
B *b <ask b> = new C;
b->m();
return 0;
}
CCC
What is printed by the following program?
#include <iostream>
using namespace std;
int i = 5;
class A {
public:
A() {i=10;}
~A() {i=20;}
};
int foo() {
i=30;
A a;
return 0;
}
int main() {
foo();