Number of moves:
you are given a nxn square chessboard with one bishop and k number of obstacles placed on it. A bishop can go to different places in a single move. find the total no.of places that are possible for the bishop in a single move. Each square is referenced by a type describing the row, R, and column, C, where the square is located.
explanation: given N=6 K=2
bishop position 5 2
obstacle positions (2 2), (1 5)
the bishop can move in so o/p is 6
I/p:
6 2
5 2
2 2
1 6
O/p:
6
I/p:
6 4
3 3
1 3
3 1
5 1
1 5
O/p: 7
Dice Score:
two friends are playing a dice game, the game is played with five six-sided dice. scores for each type of throws are mentioned below.
three 1's = 1000 points
three 6's = 600
three 5's = 500
three 4's = 400
three 3's = 300
three 2's = 200
one 1 = 100
one 5 = 50
I/p: 2
1 1 1 1 1
6 6 6 1 5
O/p: 1200
750
I/p: 2
2 1 5 2 2
1 1 1 2 2
O/p: 350
1000
Pager:
Imagine a paper with only one button. for the letter "A", you press the button one time, for "B", you press it 2 times for "E", you press it five times. for "G", it's pressed seven times, etc.
Given a string s, print the total number of times the button should be pressed
explanation: given string is abde. then the total no. of times the button pressed is 1+2+4+5=12
I/p: abde
O/p: 12
I/p: xyz
O/p: 75
given a matrix of M rows & N columns, you need to find the smallest number in each row & print the sum of the smallest numbers from all rows.
explanation: M=3. given matrix is
1 2 3
4 5 6
7 8 9
the minimum elements of each row 1, 4, 7 => sum is 1+4+7=12
I/p: 3 3
1 2 3
4 5 6
7 8 9
O/p: 12
I/p: 2 3
0 12 -13
-10 0 10
O/p: -23
View wireless and wired NIC information
Write a program to find the table of numbers using a while loop. Your program should ask the size of the table. That size defines the rows and columns. Use while loop only for this program.
Create a c# program that determine the IP address configuration of a computer
m rows, n columns:
input:
3,3
output:
1 2 3
4 5 6
7 8 9
Write appropriate C++ statement/s for each of the given conditions below.
1.
A
function call
that passes the value of
x
. The function is named as
getNumber
.
2.
A
function call
that passes the values of two parameters
x
and
y
. The function is named
as
computeArea
.
3.
A
function heading
named
minimum
with two integer parameters called
n1
and
n2
and
returns an integer result.
4.
A
function heading
of void function named as
computeP
erimeter
with two integer
parameters called
p1
and
p2
.
5.
A
void function
named as
check
with one formal parameter of type integer, that will
determine if the value
received in the parameter is positive or negative.
validation:
username should be in between 4 and 25
should start with letters but not underscore
should not be special characters
input:
output:
true
input:
google@123
output:
false