Interview Question


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

Which company?

- Animesh February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

# include <iostream>
# include <cmath>
# include <cstring>
# include <ctype.h>
using namespace std;
int main()
{
char data[9] = "pulchowk";

// cout<<"test data[0]:"<<data[0];
for (int row = 0; row< 8; row++)
{
for (int col = 0; col<= row; col++)
{
if (row % 2 == 0 )
{
if (col % 2 == 0)
{
cout<<data[col];
//putchar(col);
}
else
{
char t = toupper (data[col]);
cout<<t;
//putchar(col);
}
}
else
{
if (col % 2 == 0)
{
char t = toupper (data[col]);
cout<<t;
}
else
{
cout<<data[col];
}
}
}cout<<endl;
}
return (0);
}

- Kriti Gupta February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

# include <iostream>
# include <cmath>
# include <cstring>
# include <ctype.h>
using namespace std;
int main()
{
char data[9] = "pulchowk";

// cout<<"test data[0]:"<<data[0];
for (int row = 0; row< 8; row++)
{
for (int col = 0; col<= row; col++)
{
if (row % 2 == 0 )
{
if (col % 2 == 0)
{
cout<<data[col];
//putchar(col);
}
else
{
char t = toupper (data[col]);
cout<<t;
//putchar(col);
}
}
else
{
if (col % 2 == 0)
{
char t = toupper (data[col]);
cout<<t;
}
else
{
cout<<data[col];
}
}
}cout<<endl;
}
return (0);
}

- Kriti Gupta February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

# include <iostream>
# include <cmath>
# include <cstring>
# include <ctype.h>
using namespace std;
int main()
{
char data[9] = "pulchowk";

// cout<<"test data[0]:"<<data[0];
for (int row = 0; row< 8; row++)
{
for (int col = 0; col<= row; col++)
{
if (row % 2 == 0 )
{
if (col % 2 == 0)
{
cout<<data[col];
//putchar(col);
}
else
{
char t = toupper (data[col]);
cout<<t;
//putchar(col);
}
}
else
{
if (col % 2 == 0)
{
char t = toupper (data[col]);
cout<<t;
}
else
{
cout<<data[col];
}
}
}cout<<endl;
}
return (0);
}

- Kriti Gupta February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

# include <iostream>
# include <cmath>
# include <cstring>
# include <ctype.h>
using namespace std;
int main()
{
char data[9] = "pulchowk";

// cout<<"test data[0]:"<<data[0];
for (int row = 0; row< 8; row++)
{
for (int col = 0; col<= row; col++)
{
if (row % 2 == 0 )
{
if (col % 2 == 0)
{
cout<<data[col];
//putchar(col);
}
else
{
char t = toupper (data[col]);
cout<<t;
//putchar(col);
}
}
else
{
if (col % 2 == 0)
{
char t = toupper (data[col]);
cout<<t;
}
else
{
cout<<data[col];
}
}
}cout<<endl;
}
return (0);
}

- kg February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

String s="pulchowk";
		for(int i=0;i<s.length();i++){
			if(i%2==0){
				for(int j=0;j<=i;j++){
					Character c=s.charAt(j);
					if(j%2==0){
						System.out.print(c.toString().toLowerCase());
					}else{
						System.out.print(c.toString().toUpperCase());
					}
					
				}
			}else{
				for(int j=0;j<=i;j++){
					Character c=s.charAt(j);
					if(j%2==0){
						System.out.print(c.toString().toUpperCase());
					}else{
						System.out.print(c.toString().toLowerCase());
					}
				}
			}
			System.out.println();
		}

- shivam February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Good

- good February 23, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

private static void PrintPattern()
{
string str = "pulchowk";
bool startCase = false;
for(int i=0;i<str.Length;i++)
{
if (i % 2 == 0)
startCase = false;
else
startCase = true;
for (int j = 0; j <= i; j++)
{
if (startCase)
{
Console.Write(char.ToUpper(str[j]));
startCase = false;
}
else
{
Console.Write(char.ToLower(str[j]));
startCase = true;
}
}
Console.WriteLine();
}
}

- Prav February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

private static void PrintPattern()
{
string str = "pulchowk";
bool startCase = false;
for(int i=0;i<str.Length;i++)
{
if (i % 2 == 0)
startCase = false;
else
startCase = true;
for (int j = 0; j <= i; j++)
{
if (startCase)
{
Console.Write(char.ToUpper(str[j]));
startCase = false;
}
else
{
Console.Write(char.ToLower(str[j]));
startCase = true;
}
}
Console.WriteLine();
}
}

- Prav February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

simple

- Prav February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Which company?

- Prav February 23, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using System;
class Name {
	public static void Main() {
		String s="kapil";
		for(int i=0; i<s.Length; i++){
			for(int j=0; j<=i; j++){
				if((i+j)%2==0)	Console.Write(s[j].ToString().ToUpper());
				else	Console.Write(s[j]);
			}
			Console.WriteLine();
		}
	}

}

- Kapil February 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using System;
class Name {
	public static void Main() {
		String s="kapil";
		for(int i=0; i<s.Length; i++){
			for(int j=0; j<=i; j++){
				if((i+j)%2==0)	Console.Write(s[j].ToString().ToUpper());
				else	Console.Write(s[j]);
			}
			Console.WriteLine();
		}
	}

}

- Kapil February 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

word="pulchowk"

for i in range(1,9):
    newword=word[0:i]
    for j in range(len(newword)):
        if(j%2==0 and i%2==0):
            #print j,
            newword= newword.replace(newword[j],newword[j].upper())
        elif (j%2!=0 and i%2!=0):
            newword= newword.replace(newword[j],newword[j].upper())
    print newword

- Ankit February 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

private static void printPattern(String word){
int lenght = word.length();
StringBuffer oddWord = new StringBuffer();
StringBuffer evenWord = new StringBuffer();

for(int i = 0 ; i < lenght ; i++){
char c = word.charAt(i);
if(i%2 != 0){
oddWord.append(c);
evenWord.append(Character.toUpperCase(c));
}else{
oddWord.append(Character.toUpperCase(c));
evenWord.append(c);
}

if(i%2 != 0){
System.out.println(oddWord);
}else{
System.out.println(evenWord);
}

}

}

- DeFault February 24, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More