0% found this document useful (0 votes)
66 views12 pages

Ch3 - Question and Solutions

kt paper

Uploaded by

forlogin830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views12 pages

Ch3 - Question and Solutions

kt paper

Uploaded by

forlogin830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. Write a program in solidity to check whether a number is prime or not.

(Nov22,5)
2. Write a program in solidity to implement multilevel inheritance.
Example: Multil

evel
Inheritance
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.6.0;
contract A
{
string internal x;
string a = "Hi" ;
string b = " Alex";
function getA() external
{
x = string(abi.encodePacked(a, b));
}
}
contract B is A
{
string public y;
string c = " and Bob";
function getB() external payable returns(string memory)
{
y = string(abi.encodePacked(x, c));
}
}
contract C is B
{
function getC() external view returns(string memory)
{
return y;
}
}
contract caller
{
C cc = new C();
function testInheritance() public returns (string memory)
{
cc.getA();
cc.getB();
return cc.getC();
}
}
Q. Explain fixed and Dynamic arrays in solidity with suitable examples.(Nov. 22 and
May 23, 10 M)
Q. Write Short Note on Fallback function in solidity (May 23, 10M)

Q. Write a program in solidity to find the second largest element in an array. (May23,10M)

Q. Write a program in solidity to implement single inheritance(May23, 10M)


Q. Explain different visibility specifier of functions in solidity with example(Dec 23,10M)

You might also like