Persistent Systems Interview Questions
- 0of 0 votes
AnswerCaeser;s Cipher is a very famous encryptiontechnique used in crptography.It is a type of substitution cipher in which each letter in the plaintext is replaced by letter some fixed number of positions down the alphabet.For example,with a shift of 3 ,D would be replaced bt G,E would become H,X would become A and so on.
- ruchitraj93 March 03, 2017 in India
Encryption of a letter x by a shift k can bedescribed mathematically as Ek(X)=(X+K)%26.
Given a plain text and it's corresponding ciphertext,output the minimum no negative value of shift that was used to encrypt the plaintext or else output -1 if it is no possible to obtain the given ciphertext from the given plaintext using caeser's cipher technique.
Input
The first line of the input contains Q,denoting the number of queries.
The next Q lines contain two strings s and t consisting of only uppercase letters
output::
For each test case,output a single non negative integer denoting the minimum value of shift that was used to encrypt the the plaintext or else print -1 if the answer does not exist.
Sample Input OUTPUT
2 3
ABC -1
DEF
AAA
PQR| Report Duplicate | Flag | PURGE
Persistent Systems SDE1 - 0of 0 votes
Answerswhat is output for below code and what is purpose of using const type for pointer variable p?
- sharathvadla March 30, 2016 in United States
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[10]="HELLO";
char *const p=a;
clrscr();
//puts(p);
printf("%s",p);
*p='n';
//puts(p);
printf("%s",p);
getch();
}| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer C - 0of 0 votes
AnswersInt a=10;
- sharathvadla March 29, 2016 in India
Int b=a>15;
Print("%d",b);
a)15
b)10
c)0
d)1| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer C - 0of 0 votes
AnswersUsing which data structures the arthematic expressions can be calculated?
- sharathvadla March 29, 2016 in India| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer - 0of 0 votes
AnswersFind a sub string in a given string and replace it with another string?
- sharathvadla March 29, 2016 in India| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer Coding - 0of 0 votes
Answersinput[] ={"ab","cd","f","ab","ef","abc"}
- samkou February 14, 2016 in India
if we search in string s ="ab"; then
output 3| Report Duplicate | Flag | PURGE
Persistent Systems Java Developer - 0of 0 votes
Answersinput ={"p","q","r"},{"p","s","w"}
- samkou February 14, 2016 in India
return intersection value {"p"}
output:{"p"}| Report Duplicate | Flag | PURGE
Persistent Systems Java Developer - 0of 0 votes
AnswersDesign an algorithm that, given a set S of n integers and another integer x,
- m.saikiranreddy September 13, 2014 in India
determines whether or not there exist k (n>k>2) elements in S whose sum is
exactly x. Please give the running time of your algorithm| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer Algorithm - 0of 0 votes
AnswersIn Byteland they have a very strange monetary system. Each Bytelandian gold coin has an integer number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3 and n/4. But these numbers are all rounded down (the banks have to make a profit).
You can also sell Bytelandian coins for American dollars. The exchange rate is 1:1. But you can not buy Bytelandian coins. You have one gold coin. What is the maximum amount of American dollars you can get for it?
Input The input will contain several test cases (not more than 10). Each testcase is a single line with a number n, 0 <= n <= 1 000 000 000. It is the number written on your coin.
Output For each test case output a single line, containing the maximum amount of American dollars you can make.
Explanation You can change 12 into 6, 4 and 3, and then change these into $6+$4+$3 = $13. If you try changing the coin 2 into 3 smaller coins, you will get 1, 0 and 0, and later you can get no more than $1 out of them. It is better just to change the 2 coin directly into $2. Pls suggest a better approach.
Here's My code:
- yash April 18, 2014 in Indiaimport java.util.*; class Bytelandain { Vector v= null; Scanner sc = null; public Bytelandain() { v = new Vector(); sc = new Scanner(System.in); int i=1; String s =null; while (i<=10 ) { s = sc.nextLine(); if( s.equals("") ) break; int temp = Integer.parseInt(s); v.add(temp); i++; } for(i=0;i<v.size();i++) { showProfit((Integer)v.get(i)); } } public static void main(String args[]) { Bytelandain by = new Bytelandain(); } public void showProfit(int num) { System.out.println(computeValue(num)); } public int computeValue(int num) { int value = 0; if(num<=2) { return num; } value = getProfit(num,value); if(num >= value) { return num; } return value; } public int getProfit(int num,int value) { int sum; sum = value; sum = sum+ computeValue(num/2)+computeValue(num/3)+computeValue(num/4); return sum; } }
| Report Duplicate | Flag | PURGE
Persistent Systems Developer Program Engineer - 0of 0 votes
AnswersWrite a program to read improperly indented C code from a file and add tabs and new lines as per convention in a new file. (Eg. After a control statement is encountered, print the opening brace on a new line. Then, on the line after that, increase indentation and begin writing code. Reduce indentation when a closing brace is encountered by the file pointer).
- sue October 21, 2012 in United States| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer C - 0of 0 votes
AnswersProgram to create a game of SUDOKU.
- manishvaidya June 21, 2012 in India| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer - 0of 0 votes
AnswersDo in place sorting of the given array such that all 0's moves to right and all 1's to left and their relative positioning remains same. Input array a =01001011101
- sumit February 19, 2012 in India
output : 00000111111| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer Arrays