Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views8 pages

Parikshak - Online Program Grading Tool

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)
7 views8 pages

Parikshak - Online Program Grading Tool

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
You are on page 1/ 8

10/22/24, 7:46 PM Parikshak: Online Program Grading Tool

Welcome sakec_025

Time Left: 02:03:20


Reading Time: 5 min.

1) Problem Statement :

Note:
m >= 0
n >= 0
m and n should be finite value.

Input Specification:
The First Input to the Program is m.
The Second Input to the Program is n.

Output Specification:
Last line should be Output for the function.
For invalid input program should print "Invalid Input".

Sample I/O:
INPUT LINE 1: 0
INPUT LINE 2: 5
OUTPUT: 6

2) Problem Statement :

Print a pattern of numbers from to as shown below. Each of the numbers is separated by a single space.

4444444
4333334
4322234
4321234
4322234
4333334
4444444

Constraints

2 <= n < 10

Input Specification:

Input Format

The input will contain a single integer .

Output Specification:
Pattern will be printed with single space between numbers.
For invalid number program should Output "Invalid Input".

https://parikshak.in/onlinetestform.html?testId=2058280 1/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool

Sample I/O:
INPUT:
4
OUTPUT:

4444444
4333334
4322234
4321234
4322234
4333334
4444444

3) Problem Statement :
SAKEC has decided to create a maze, next to it's library, so that only intelligent people can go into the library. As is typical of mazes, this one
too has several dead ends and only one correct start and end point. You have to write a program to navigate this maze and enter the library.

Your starting point in the maze is marked by the character '#' and the entrance to the library (i.e., end point of the maze) is marked by the
character '@', i.e. your program must start from
'#' and end at '@'.

The maze is composed of a rectangular array of cells. Apart from the start (#) and end (@) cells, maze contains solid cells and empty cells. A
valid path never passes via a solid cell. The solid cells are marked by 0s and empty cells are marked by 1s. Once on a cell, you can
only move to any one of the neighbouring four (i.e., north, east, west, south) cells.

Note: Assume that no path will ever cross itself, i.e., there will be no loops in any path.+

Input Specification:

1. Thefirst line of input will be two integers, R and C, specifying the number of rows and columns.
2. Thenext R lines contain C characters each separated by white space, thereby specifying the layout of the maze. It is guaranteed that
the maze will contain only one starting and one ending character. Also, it is guaranteed that the maze will contain only one correct path,
from the start point to the end point.

Output Specification:
Your program must output on one line, the number of hops required to reach the end point.

Sample I/O:
Sample Input 1
5 10
@111111111
0000000001
0101011101
1111010001
#001111111
Sample Output1
24
Sample Input2
5 5
0 0000
0 0000
0 #@00
0 0000
0 0000
Sample Output2
1

4) Problem Statement :
A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your
task is to write a program that checks if a given string is a palindrome or not.
Constraints:

The input string contains only alphanumeric characters and spaces.


The length of the input string is at most 100 characters

https://parikshak.in/onlinetestform.html?testId=2058280 2/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool

Input Specification:
The input consists of a single string S (1 ≤ |S| ≤ 100), where S is the string to be checked for palindrome.

Output Specification:
If the string is not valid then output "INALID-INPUT" (without quotes).
If the input string is a palindrome, output "YES" (without quotes).
If the input string is not a palindrome, output "NO" (without quotes).

Sample I/O:
CASE-1:-
Input:
radar
Output:
YES

CASE-2:-
Input:
hello
Output:
NO

CASE-3:-
Input:
A man a plan a canal Panama
Output:
YES

5) Problem Statement :
Write a program to print an isometric angle triangle pattern using asterisks (*).
Constraints:
The maximum size of the triangle will be 10 and minimum size is 1.

Input Specification:
The input will be an integer value indicating the size of the triangle.

Output Specification:
If invalid input then output "INVALID-INPUT".
Print the isometric angle triangle pattern using asterisks (*).

Sample I/O:
CASE1:-
Input:
5
Output:
*
***
*****
*******
*********

6) Problem Statement :
Given an integer N, consider all arrays A of size N such that:
All the elements are non-negative and distinct.
All prefix sums are odd. Formally, for all i such that 1 <= i <= N , ∑
Among all possible arrays A, output the smallest possible sum of the elements of the array.
The maximum size of N can be 10. It should not accept any number less than 1 or more than 10. In that case output should be, "Constraint not satisfied."

Input Specification:
The first line contains N number of elements of the array.

Output Specification:

1. First line the smallest sum among all arrays satisfying the constraints.
2. On second line it should show the array elements separated by space.
3. The Third line should should print the subsequent array prefix sum separated by space.

https://parikshak.in/onlinetestform.html?testId=2058280 3/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool

Sample I/O:
Input:
3
Output:
3
102
113

Input:
2

Output:
1

10
11

7) Problem Statement :
For a positive, even integer N, we call a pair of arrays A and B to be interesting if they satisfy the following conditions :

1. ∣A∣=∣B∣=N/2 i.e. the length of array A is equal to the length of array B.


2. Each integer from 1 to N occurs exactly once in exactly one of the arrays.
3. The i th prefix sum of A is not equal to i th prefix sum of B for all 1 ≤ i ≤ (N/2 − 1).
4. Sum of all elements in A is equal to sum of all elements in B.

You are given a positive, even integer N. If there exists an interesting pair of arrays, then print "YES" followed by an interesting pair for this given N. If there exists multiple
interesting pairs of arrays for given N, you can print any. Print "NO" in a single line if no such pair exists.

For invalid input display output as "Constraints not satisfied."

Input Specification:

1. First line of input will contain T the number of test cases. Then the test cases follow.
2. Each test case contains a single line of input, the integer N.

Output Specification:

1. If there exists an interesting pair of arrays, say (A,B), then in the first line print "YES", in the second line print array A separated by spaces, and in third line print array B separated by spaces.
2. Print "NO" in a single line if no such pair exists.

Sample I/O:
Input:
2
2
4
Output:
NO
YES
14
23

8) Problem Statement :
Chef has three numbers A,B, and C.
He can do the following type of operation:
Select two numbers amongst A,B, and C;
Add 1 to the selected numbers; Subtract 1 from the remaining number.
Determine whether Chef can make all the three numbers equal after applying the above operation any number of times.
If yes, output the minimum number of operations required by Chef.

Input Specification:
Each input consists of single line containing 3 space-separated integers A,B, and C.

Output Specification:

https://parikshak.in/onlinetestform.html?testId=2058280 4/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool
Output −1 if the numbers cannot be made equal, else output the minimum number of operations required to make them equal.

Sample I/O:
Example 1:
Input: 1 1 2
Output: -1
Explnation: It can be proven that we cannot make the numbers equal using any number of operations.
Example 2:
Input: 3 7 3
Output: 2
Explnation: We require a minimum of 2 operations to make the numbers equal:
Operation 1: Select the numbers A and C. Thus, A and C become 3+1=4 and 3+1=4 respectively. Also, B becomes 7−1=6.
Operation 2: Select the numbers A and C. Thus, A and C become 4+1=5 and 4+1=5 respectively. Also, C becomes 6−1=5.

9) Problem Statement :
Read Image.

Input Specification:
The first line of each contains a single integer N.
The second line contains N space-separated integers B[1],B[2],…,B[N].

Output Specification:
Print a single line containing N space-separated integers denoting the array A you constructed. If no such array A exists, print −1 instead.

Sample I/O:
Example 1:
Input:
2
42
Output:
4 26
Explnation: One possible answer is [4,26] because B can be generated as follows: B=[gcd(4),gcd(4,26)]=[4,2].

Image:

10) Problem Statement :


You are tasked with building a simple browser history navigation system using a stack data structure. The system will allow users to visit new pages, go back to the previous
page, and check the current page they are on. You must implement this system using an array-based data structure.
Environment:

You will implement the browser history using a Array-basd Data Structure, where each web page visited is inserted into the data structure.
When the user goes back, the lastest page is deleted from the data structure, and the second last page becomes the current page.
When the user visits a new page, it is inserted into the data structure.
Users can also query the current page at any time.
There is no functionality for "forward" navigation in this system, only backward.

Functions/Operations:

1. visit [URL]:
Visit a new URL. This URL will be inserted into the data structure.
Example: visit google.com
2. back:
Go back to the previous page by deleting the current URL from the data structure.
If there are no previous pages (i.e., only one page is in the data structure), output "No previous page".
3. current:
Display the current page (latest of the data structure).
4. quit:
Ends the simulation.

Function Prototypes:

https://parikshak.in/onlinetestform.html?testId=2058280 5/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool
visit(url: str) -> void: inserted the URL into the data structure.
back() -> void: delete the current URL and display the new current URL or display "No previous page".
current() -> str: return the URL of the current page (latest of the data structure).

Input Specification:
The first input is an integer n which represents the number of operations.
The next n lines contain one of the operations: visit [URL], back, current, or quit.

Output Specification:
For each current command, print the current page URL and print "No previous page" if no page.
For each back command, print "No previous page" if back cannot be performed; otherwise, print the new current page.

Sample I/O:
Example:
Input:
7
visit google.com
visit facebook.com
current
back
current
visit youtube.com
current
Output:
facebook.com
google.com
google.com
youtube.com

11) Problem Statement :


Implement Stack using the Linked List.
Operation Code:
1--------> PUSH
2--------> POP
3--------> EXIT

Input Specification:
Input can be multiple lines as sequence of operations.
In case of PUSH Operation First Line will be 1 which is operation code and second line is value to be pushed.
In case of POP Operation Only one line will be there which is 2 as an operation code.
Each Input sequence will be terminated by 3 which is exit operation code.

Output Specification:
After performing PUSH operation is should show stack Contents as follow:
"STACK Content/(s): 5,10,20"
where every no is separated by comma.
After POP Operation it should deleted as:
"Deleted value from link list is: <<deleted no>>."
Second Line will be revised stack content as per above format.
In case no element present then display "STACK is empty."

Sample I/O:
Example-1:
Input:
1
10
1
5
1
1
2
2
3
Output:
STACK Content/(s): 10
STACK Content/(s): 5,10
STACK Content/(s): 1,5,10

https://parikshak.in/onlinetestform.html?testId=2058280 6/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool
Deleted value from link list is: 1.
STACK Content/(s): 5,10
Deleted value from link list is: 5.
STACK Content/(s): 10

Example-2:
Input:
1
10
1
5
1
1
2
2
2
2
3
Output:
STACK Content/(s): 10
STACK Content/(s): 5,10
STACK Content/(s): 1,5,10
Deleted value from link list is: 1.
STACK Content/(s): 5,10
Deleted value from link list is: 5.
STACK Content/(s): 10
Deleted value from link list is: 10.
STACK is empty.
STACK is empty.

12) Problem Statement :


Implement Queue using the Linked List.
Operation Code:
1--------> Insert
2--------> Delete
3--------> EXIT

Input Specification:
Input can be multiple lines as sequence of operations.
In case of insert Operation First Line will be 1 which is operation code and second line is value to be inserted.
In case of delete Operation Only one line will be there which is 2 as an operation code.
Each Input sequence will be terminated by 3 which is exit operation code.

Output Specification:
After performing insert operation is should show queue contents as follow:
"QUEUE = "
After delete operation it should deleted as:
"Deleted Data = 4"
Second Line will be revised queue content as per above format.
In case no element present then display "QUEUE EMPTY"

Sample I/O:
Example-1:
Input:
1
10
1
5
1
1
2
2
3
Output:
QUEUE = 10
QUEUE = 10 5
QUEUE = 10 5 1
Deleted Data = 10

https://parikshak.in/onlinetestform.html?testId=2058280 7/8
10/22/24, 7:46 PM Parikshak: Online Program Grading Tool
QUEUE = 5 1
Deleted Data = 5
QUEUE = 1
Example-2:
Input:
1
10
1
5
1
1
2
2
2
2
3
Output:
QUEUE = 10
QUEUE = 10 5
QUEUE = 10 5 1
Deleted Data = 10
QUEUE = 5 1
Deleted Data = 5
QUEUE = 1
Deleted Data = 1
QUEUE EMPTY
QUEUE EMPTY

Parikshak Team Last updated:04-Oct-2024 16:21


parikshak[at]cdac[dot]in
Copyright © 2013 C-DAC, Mumbai. All rights reserved

https://parikshak.in/onlinetestform.html?testId=2058280 8/8

You might also like