0% found this document useful (0 votes)
1K views

Fractal Previous Year Coding Questions Super Dream

Uploaded by

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

Fractal Previous Year Coding Questions Super Dream

Uploaded by

mahima 008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Fractal previous year Coding questions – Test 2

1. To check a variable name is valid or invalid. Variable rules are:


 variables must begin with letter (both uppercase and lowercase letters) or underscore.
 They can be constructed with digits, letters.
 No special symbols are allowed other than underscore_.
 It cannot be longer than 31 characters.
 It cannot be a keyword.

Input Format
Input consists of a string.
Output Format
Output displays whether the string is a valid variable name or not.
Sample 1 Input
int
Sample 1 Output
int is invalid

2. Given an integer, write a program to convert it into an MS-Excel column. MS Excel


columns has a pattern like A, B, C, … ,Z, AA, AB, AC,…. ,AZ, BA, BB, … ZZ, AAA,
AAB ….. etc. In other words, column 1 is named as “A”, column 2 as “B”, column 27 as
“AA”.
Input Format
Input consists of an integer N.
Output Format
Print the MS-Excel column name for the corresponding input.
Sample 1 Input
4
Sample 1 Output

D
3. Clement has special number series, the number in the series only contains prime factors
of 2,3 or 5. His teacher ram given a task that he wants to display the number in the
number series of the index n.
For Ex:
Input : n = 7
Output : 8
1, 2, 3, 4, 5, 6, 8 ,9,10,12,15..
Input Format
Enter the number n in-order to print the number in the number series.
Output Format
Display the number in the number series of the index n.
Constraints
0 < n < 100
(n should be a positive integer, decimals are not allowed).
Sample 1 Input
7
Sample 1 Output
8

4. Suppose there are N petrol pumps on a circular path. Petrol pumps are numbered from 1 to N
to (both inclusive). You have two pieces of information corresponding to each of the petrol
pump: (1) the amount of petrol that particular petrol pump will give, and (2) the distance from
that petrol pump to the next petrol pump.

Initially, you have a tank of infinite capacity carrying no petrol. You can start the tour at any of
the petrol pumps. Calculate the first point from where the truck will be able to complete the
circle. Consider that the truck will stop at each of the petrol pumps. The truck will move one
kilometer for each litre of the petrol.
Input Format
First line has the value of N and the following N lines has a pair of values which represents the
two pieces of information i.e. the amount of petrol and the distance between two pumps.
Output Format
Output displays the smallest index of the petrol pump where the tour is to be started.
Sample 1 Input
3
1 5
10 3
3 4
Sample 1 Output
2

You might also like