View Full Version : Preparation of Exams
Unknown Hero
20-02-2005, 04:54 PM
Here you can post your solutions of exams and compare them with others that programm in the same program. :ok:
Well
I did in short versions (not that short) in the normal numbers (exercise.cc)
I also made somewhat longer version. (probably better according to a book) they are called exercise-long.cc
Enjoy
edit: C++ as language
aaberg
22-02-2005, 09:22 AM
Answers in C#
1.
[STAThread]
static void Main(string[] args)
{
Console.WriteLine(Console.ReadLine());
}
2.
[STAThread]
static void Main(string[] args)
{
int a;
int b;
int result;
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
result = a + b;
Console.WriteLine(result.ToString());
result = a * b;
Console.WriteLine(result.ToString());
result = a / b;
Console.WriteLine(result.ToString());
result = a - b;
Console.WriteLine(result.ToString());
}
3.
[STAThread]
static void Main(string[] args)
{
int a;
int b;
int dummy;
a = Convert.ToInt32(Console.ReadLine());
b = Convert,ToInt32(Console.ReadLine());
dummy = a;
a = b;
b = dummy;
Console.WriteLine(a.ToString());
Console.WriteLine(b.ToString());
}
4.
[STAThread]
static void Main(string[] args)
{
int a;
int b;
int result;
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
result = a*b;
Console.WriteLine(result.ToString());
result = a + a + b + b;
Console.WriteLine(result.ToString());
}
Easy.
aaberg
23-02-2005, 11:55 AM
Originally posted by Unknown Hero@Feb 23 2005, 12:05 AM
You can chalenge me! I'm in! :ok:* :sneaky:
Ok. Here is my challenge.
Make a function, which is able to launch any stored procedure in a database, that doesn't return any queries. :evil: The prototype is shown below.
public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue);
The prototype is only a suggestion. You are free to make your own. You may program it in whatever langauage you would like.
If it is too easy, just tell me, and I figure out something harder. :Jesus:
If I have to post the answer, it will be in C#.net
Unknown Hero
24-02-2005, 08:52 PM
Originally posted by NrmMyth+Feb 24 2005, 09:23 PM****</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (NrmMyth @ Feb 24 2005, 09:23 PM)</td></tr><tr><td id='QUOTE'> Originally posted by Unknown Hero@Feb 22 2005, 03:36 PM
******QuoteBegin-aaberg@Feb 22 2005, 11:22 AM
Answers in C#
Easy.
EASY?????
Muahahahahahahahahahahah!!! :twisted:
You wont say that after a few months when I arrive at difficult ones! LOL
I see that the Unknown Hero is a good programer.
So could you please solve avion.c from the regional conest 200x.
See you in scool. :ok: [/b][/quote]
It was an exam from 2002 regional contest in Croatia (now I have to post it :ranting: :ranting: )!!!!
Here's the exam:
Imagine an aeroplane in which there is only one tiny access batween the lines of seats. Imagine passengers that enter and sit on their places.
Every passenger must sit exactly on its seat. Entrance of the aeroplane is on the begining of it. Passengers enter one by one WITHOUT any unnecessary staying and delaying.
Passenger walks trough the lines. He is needed ONE SECOND to pass from one line to another (or more if there is a jam in front of him), and FIVE SECONDS to place his things in the space above his seat. In tiny access batween lines can be only ONE PASSENGER.
Write a program that will calculate how many time is needed for access to be FREE i.e. to all passengers be sitting on their places.
ENTERING PARAMETERS:
In first line of the entering file there is a whole number N (number of passengers) 1<=n<=1000.
In (i+1) line there is a whole number R (number of line in which passenger number i must sit in) 1<=R<=1000.
Passengers are marked with numbers from 1 to N and they enter in aeroplane in that order, and the number of passengers that sit in the same line isn't limited.
EXITING PARAMETERS:
In first and only line of exiting file, you must write a time (in seconds) that is needed for all passengers to sit down.
TEST EXAMPLES:
aero.in
1
3
aero.out
7
aero.in
2
3
3
aero.out
12
aero.in
4
4
4
1
5
aero.out
19
If you have any questions about the exam, just ask. I translated it fro Croatian, so it can have some mistakes.
NrmMyth
25-02-2005, 04:08 PM
Originally posted by aaberg+Feb 23 2005, 12:55 PM****</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (aaberg @ Feb 23 2005, 12:55 PM)</td></tr><tr><td id='QUOTE'> ******QuoteBegin-Unknown Hero@Feb 23 2005, 12:05 AM
You can chalenge me! I'm in! :ok:* :sneaky:
Ok. Here is my challenge.
Make a function, which is able to launch any stored procedure in a database, that doesn't return any queries. :evil: The prototype is shown below.
public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue);
The prototype is only a suggestion. You are free to make your own. You may program it in whatever langauage you would like.
If it is too easy, just tell me, and I figure out something harder. :Jesus:
If I have to post the answer, it will be in C#.net [/b][/quote]
//First include your header with wanted stored proc
#include "yourheader.h"
//This is your function
void executeproc(void *procname(),char *parametername,char *parametervalue,int sizeofparameter)
{ void value,parameter;
if(sizeofparameter==sizeof(int))
{ sscanf("%d",&(int)parameter);
(int)value=parameter;
}
else if(sizeofparameter==sizeof(float))
{ sscanf("%f",&(float)parameter);
(float)value=parameter;
}
.
.
.
//And like this you check type and switch the void in needed type.
procname(value);
}
I did'n test it. So expect some errors.
I know it is not a very good procedure becouse i operates only with one parameter of that proc. you have stored.
And I don't know how to use function with unknown number of parameters (function(blah,blah,...)).
PS: I see you program in c# ,could you explain a little, difrences from ordinary c/c++.
I do c. :kosta:
Unknown Hero
27-02-2005, 04:37 PM
Here are the solutions for first 4 exams:
First.pas (http://kerner.dtdns.net/content/incoming/unknownhero/first.pas)
Second.pas (http://kerner.dtdns.net/content/incoming/unknownhero/second.pas)
Third.pas (http://kerner.dtdns.net/content/incoming/unknownhero/Third.pas)
Fourth.pas (http://kerner.dtdns.net/content/incoming/unknownhero/fourth.pas)
And here they are all in one 'big' txt file:
Solution.txt (http://kerner.dtdns.net/content/incoming/unknownhero/Solution.txt)
aaberg
01-03-2005, 08:44 AM
Originally posted by NrmMyth+Feb 25 2005, 05:08 PM****</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (NrmMyth @ Feb 25 2005, 05:08 PM)</td></tr><tr><td id='QUOTE'>Originally posted by aaberg@Feb 23 2005, 12:55 PM
******QuoteBegin-Unknown Hero@Feb 23 2005, 12:05 AM
You can chalenge me! I'm in! :ok:* :sneaky:
Ok. Here is my challenge.
Make a function, which is able to launch any stored procedure in a database, that doesn't return any queries. :evil: The prototype is shown below.
public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue);
The prototype is only a suggestion. You are free to make your own. You may program it in whatever langauage you would like.
If it is too easy, just tell me, and I figure out something harder. :Jesus:
If I have to post the answer, it will be in C#.net
//First include your header with wanted stored proc
#include "yourheader.h"
//This is your function
void executeproc(void *procname(),char *parametername,char *parametervalue,int sizeofparameter)
{ void value,parameter;
if(sizeofparameter==sizeof(int))
{ sscanf("%d",&(int)parameter);
(int)value=parameter;
}
else if(sizeofparameter==sizeof(float))
{ sscanf("%f",&(float)parameter);
(float)value=parameter;
}
.
.
.
//And like this you check type and switch the void in needed type.
procname(value);
}
I did'n test it. So expect some errors.
I know it is not a very good procedure becouse i operates only with one parameter of that proc. you have stored.
And I don't know how to use function with unknown number of parameters (function(blah,blah,...)).
PS: I see you program in c# ,could you explain a little, difrences from ordinary c/c++.
I do c. :kosta:[/b][/quote]
To give the function an unknown number of parameters, you need to work with arrays. Below I have written a way to solve the problem in C#.
If you open a new thread dedicated to talk about the difference between C/C++ and C#, I will gladly post.
public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue)
{
OleDbConnection objConn = new OleDbConnection("Connectionstring");
//The connectionstring depends on, which database you are using.
OleDbCommand objCommand = objConn.CreateCommand();
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.CommandText = storedProcedureName;
for (int index = 0; index < parameterName.Length; index++)
{
objCommand.Parameters.Add(parameterName[index], parameterValue[index];
}
try
{
objConn.Open();
objCommand.ExecuteNonQuery();
}
catch
{
throw new Exception("Error while executing procedure");
}
finally
{
objConn.Close();
}
}
This should work.
;)
piepsi
01-03-2005, 11:38 AM
I guess I still remember Basic :blink:
1)
PRINT "Type in somewhat and press Return"
INPUT a$
PRINT a$
2)
PRINT "Type in the first number and press Return"
INPUT a
PRINT "Type in the second number and press Return"
INPUT b
PRINT a+b
PRINT a*b
PRINT a/b
PRINT a-b
3)
PRINT "Type in the first number and press Return"
INPUT a
PRINT "Type in the second number and press Return"
INPUT b
PRINT b
PRINT a
4)
PRINT "Type in length of side a"
INPUT a
PRINT "Type in length of side b"
INPUT b
PRINT "Area is" , a*b
PRINT "Circumfence is" , a+a+b+b
Was it this that you were thinging about?
I do not know if it runs, last time i programmed it is 15 years ago :D
NrmMyth
01-03-2005, 08:43 PM
Originally posted by aaberg+Mar 1 2005, 09:44 AM****</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (aaberg @ Mar 1 2005, 09:44 AM)</td></tr><tr><td id='QUOTE'> Originally posted by NrmMyth@Feb 25 2005, 05:08 PM
Originally posted by aaberg@Feb 23 2005, 12:55 PM
******QuoteBegin-Unknown Hero@Feb 23 2005, 12:05 AM
You can chalenge me! I'm in! :ok:* :sneaky:
Ok. Here is my challenge.
Make a function, which is able to launch any stored procedure in a database, that doesn't return any queries. :evil: The prototype is shown below.
public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue);
The prototype is only a suggestion. You are free to make your own. You may program it in whatever langauage you would like.
If it is too easy, just tell me, and I figure out something harder. :Jesus:
If I have to post the answer, it will be in C#.net
//First include your header with wanted stored proc
#include "yourheader.h"
//This is your function
void executeproc(void *procname(),char *parametername,char *parametervalue,int sizeofparameter)
{ void value,parameter;
if(sizeofparameter==sizeof(int))
{ sscanf("%d",&(int)parameter);
(int)value=parameter;
}
else if(sizeofparameter==sizeof(float))
{ sscanf("%f",&(float)parameter);
(float)value=parameter;
}
.
.
.
//And like this you check type and switch the void in needed type.
procname(value);
}
I did'n test it. So expect some errors.
I know it is not a very good procedure becouse i operates only with one parameter of that proc. you have stored.
And I don't know how to use function with unknown number of parameters (function(blah,blah,...)).
PS: I see you program in c# ,could you explain a little, difrences from ordinary c/c++.
I do c. :kosta:
To give the function an unknown number of parameters, you need to work with arrays. Below I have written a way to solve the problem in C#.
If you open a new thread dedicated to talk about the difference between C/C++ and C#, I will gladly post.
public void executeStoredProc(string storedProcedureName, string[] parameterName, string[] parameterValue)
{
OleDbConnection objConn = new OleDbConnection("Connectionstring");
//The connectionstring depends on, which database you are using.
OleDbCommand objCommand = objConn.CreateCommand();
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.CommandText = storedProcedureName;
for (int index = 0; index < parameterName.Length; index++)
{
objCommand.Parameters.Add(parameterName[index], parameterValue[index];
}
try
{
objConn.Open();
objCommand.ExecuteNonQuery();
}
catch
{
throw new Exception("Error while executing procedure");
}
finally
{
objConn.Close();
}
}
This should work.
;) [/b][/quote]
Ok this is great but I don't understand a thing of object-oriented programing.
Supose I need more knowledge.
I won't open a tread becouse I don't know c++, and as I know a little c++ and c# are more diferent then ordinary c.
But thanks anyway. :ok:
NrmMyth
01-03-2005, 09:20 PM
So here is one good test for all you guys who are bored, or like chalenges.
I am posting this exam so my good friend Unknown Hero (who I know of) can take a little break.
It is called "The Number" (be afraid, be very afraid) and shouldn't be hard.
Here it goes. THE NUMBER
When all natural numbers (1,2,3,4,5), started from 1 to some known N number write in a line one after another
without a space, we get a array of numbers that looks like this:
For N=16 we get { 12345678910111213141516 }.
Write an algorithm/code that will calculate the exact number od digits of that array.
INPUT:
In one and only row there is one number N, 1<=N<=100,000,000.
OUTPUT:
In one and only row on screen you have to write the needed number from the text.
TESTS:
input
5 | 15 | 120
output
5 | 21 | 252
Good luck. :max:
NeKromancer
01-03-2005, 11:17 PM
Here's the answer the Q1 in Java.
import java.io.*;
public class exam {
private static String input = "";
private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
/**
* *Constructor
*/
public static void main(String[] args) {
*
*int x = -999;
*int y = -999;
*
*try {
* x = getNumber("x");
* y = getNumber("y");
* in.close();
*}
*catch(IOException ex) {
* ex.printStackTrace();
*}
*
*System.out.print("second_root_of(x*x+y*y) is ");
*System.out.println(secondRootOf(x,y));
*
}
/**
* Function secondRootOf(int , int)
*
* @return int
*/
private static int secondRootOf(int x, int y)
{
*return x*x+y*y;
}
/**
* *Function getNumber(String)
* *
* *@exception NumberFormatException
* *@throws IOException
* *@return int
*/
private static int getNumber(String which) throws IOException
{
*boolean stop = false;
*int num = 0;
*
*while(!stop) {
*
* try {
* *System.out.print("Enter "+which+": ");
* *input = in.readLine();
* *num = Integer.parseInt(input);
* *
* *if(num < 0) {
* * num = num*-1;
* *}
*
* *stop = true;
* }
* catch(NumberFormatException nfe) {
* *System.out.println("Not a valid integer, try again");
* *stop = false;
* }
*}
*
*return num;
}
}//end class
NeKromancer
02-03-2005, 07:51 PM
Gives me a headache just reading the problem. Reminds me of math problems in school, and I hate math and hate school :rifle:
Unknown Hero
02-03-2005, 07:54 PM
Originally posted by NeKromancer@Mar 2 2005, 09:51 PM
Gives me a headache just reading the problem. Reminds me of math problems in school, and I hate math and hate school :rifle:
NrmMyth solved this problem without using mathemathics! :ok: :ok: :ok:
Unknown Hero
02-03-2005, 08:00 PM
Here's my solution for Number:
program broj;
var n,x,i:longint;
begin
x:=0;
readln(n);
for i:= 1 to n do
begin
if (i<10) then
x:=x+1
else if (i<100) then
x:=x+2
else if (i<1000) then
x:=x+3
else if (i<10000) then
x:=x+4
else if (i<100000) then
x:=x+5
else if (i<1000000) then
x:=x+6
else if (i<10000000) then
x:=x+7
else if (i<100000000) then
x:=x+8;
end;
writeln(x);
end.
Here's optimal solution for the Number:
program broj;
var n, rj, i : longint;
begin
readln(n);
rj := n;
i := 9;
while n>i do
begin
n := n-i;
rj := rj + n;
i := i*10;
end;
writeln(rj);
end.
Kon-Tiki
02-03-2005, 08:11 PM
I'm not too fond of solving problems like that either. They do sound like mathproblems from school.
"If train A leaves station A at 13h40 and drives at 80Km/h and train B leaves at station C at 14h00, driving at 70Km/h, when will they cross each other at station B, which is 112Km from station A and 120Km from station B?" Kind of feels the same as that one.
NeKromancer
03-03-2005, 02:57 AM
Answer to UnknownHero's Q2 of his Exam2.
I only had to change 1 method from my previous program for Q1, ahh the goodness of software reuse :cheers:
import java.io.*;
public class exam2 {
private static String input = "";
private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
/**
* *Constructor
*/
public static void main(String[] args) {
*
*int num = -1;
*
*try {
*
* num = getNumber("a number");
* in.close();
*}
*catch(IOException ex) {
* ex.printStackTrace();
*}
*
*calcWeirdMethod(num);
}
private static void calcWeirdMethod(int num) {
*int x = 0;
*
*for(int i=1; i <= num; i++) {
* x = x+i;
*}
*
*System.out.println("Answer is : "+x);
}
/**
* *Function getNumber(String)
* *
* *@exception NumberFormatException
* *@throws IOException
* *@return int
*/
private static int getNumber(String which) throws IOException
{
*boolean stop = false;
*int num = 0;
*
*while(!stop) {
*
* try {
* *System.out.print("Enter "+which+": ");
* *input = in.readLine();
* *num = Integer.parseInt(input);
* *
* *if(num < 0) {
* * num = num*-1;
* *}
*
* *stop = true;
* }
* catch(NumberFormatException nfe) {
* *System.out.println("Not a valid integer, try again");
* *stop = false;
* }
*}
*
*return num;
}
}//end class
NrmMyth
04-03-2005, 09:39 PM
Ok! here it is, the fast solution to "Number".
Bunch of if-s and all works...
long solution(long n)
{ long digits;
if(n<10)
digits=n;
else if(n<100)
digits=(n-9)<<1+9;
else if(n<1000)
digits=(n-99)*3+189;
else if(n<10000)
digits=(n-999)<<2+2889;
else if(n<100000)
digits=(n-9999)*5+38889;
else if(n<1000000)
digits=(n-99999)*6+488889;
else if(n<10000000)
digits=(n-999999)*7+5888889;
else if(n<100000000)
digits=(n-9999999)<<3+68888889;
else digits=788888889;
return digits;
}
It is'n very prety solution but on the other hand it is fast as lighting (:whistle: kung fu fighting).
And why can't I use tabulators! :ranting:
Any questions? :ph34r:
Kon-Tiki
04-03-2005, 09:57 PM
Ok, mathless exam:
A bookstore wants to have a utility that helps them catalogue their books. They have diskettes with files containing information per book. Each book contains this as information: Book title, subtitle if it's available, a list of authors (most of the time one, but can be more), number of pages, price - with the option of seeing it without 21% tax, ISDN-number, category it belongs to and whether it's hard-cover or not.
Their utility has to be able to read in the diskette containing this information, along with listing the books alphabetically on main title, on first author (if the name's the same, on second author too. Name there the same, third author, etc), list from cheapest to most expensive, from most expensive to cheapest, per category and just all books in total.
They also should be able to change the information 'bout a book if they see it needed, or add a book to the file.
Create this utility. It's not required to have a fancy interface. Text-based's just fine.
NrmMyth
05-03-2005, 03:05 PM
Take a look at this easy exam.
The input is the height of the piramide you have to print it.
height=4
* **
* * *
** * *
* * * *
You got the point.
Unknown Hero
08-03-2005, 06:10 PM
Today was holded regional contest in programming in Croatia.
I didn't make it up to national contest, but NrmMyth will maybe make it with his score! (great job mate) :ok: :ok:
Here are exams:
1. Abbrevation(shortcut)
Read a sentence which consists of one or more words that are separated with one space.
We make an abbrevation of read sentence by picking up the begining letter of every word in sentence, excapt if that word is one of the following: 'i','pa','te','ni','niti','a','ali','nego','no' , and 'ili'
In that case we ignore the word. BUT, if the sentence begins with one of the words, we consider that word very importants, so we don't ignore it (at the begining, later on, we ignore it).
Write a program that will determine a abbrevation for a read sentence. Abbrevation MUST be written with CAPS ('A' instead of 'a').
Entering parameters:
In first and only line, there is a sentence. Only permited characters inside the sentence are small letters of english alphabet ('a'...'z') and space.
Sentence wont have more than 100 characters.
Exiting parameters:
In first and only line write a abbrevation of read sentence.
Test examples:
abb.in
mirko soft
abb.out
MS
abb.in
biti ali i ne biti
abb.out
BNB
abb.in
ali ja sam i jucer jeo
abb.out
AJSJJ
Unknown Hero
08-03-2005, 06:35 PM
2. Exam
Luka dislikes learning, but anyways, he will like to pass the most difficulty exam on the first year. During his last visit to university's canteen, he overheard that all students of second year know which questions will be in his exam. The truth is that no one actually knows it, but everyone thinks that someone else knows.
Luka now chooses person A from the second year and asks him what questions will be in the exam. Person A responds that he doesn't know, but that he thinks that person B knows. Then Luka asks the same question to person B, etc.
Write a program that will determine which student Luka should first ask about the exam, so that the number of questioned students is the biggest possible.
Entering parameters:
In the first line there is a whole number N, 2<=N<=1000, the number of students. Students are marked with numbers from 1 to N.
In every of next N lines there is one number. First number determines ordinal number of student that first student will send Luka to ask him about the exam, second number determines ordinal number of student that second student will send Luka to ask him about Exams, and so on.
Exiting parameters:
In first and only line write an ordinal number of student that Luka have to ask first about the exam, so that the number of students that he will meet on that way could be the biggest possible.
If there are more these students, then write a number of that student that has the smallest ordinal number.
Test examples:
exam.in
3
3
3
1
exam.out
2
exam.in
4
2
3
4
1
exam.out
1
exam.in
6
2
3
4
3
1
1
exam.out
5
Two more to go. I will post those two after at least one of members tries to solve one or both of previous two exams. :ok:
NrmMyth
08-03-2005, 07:27 PM
Thanks for commend.
But i think the lowest points are 50% of all points(which I don't have).
Sorry for disapointment. :ok:
I think that's a great ideat to translate the exams in this topic.
Salute!
???If it were more time!!! ::cry:
NrmMyth
10-03-2005, 06:37 PM
For the library program I have to tell you that it will be done until next sunday (after this) [:tomato:] becouse I have to write my work from math for tuesday. And it is large!
NrmMyth
20-03-2005, 09:24 PM
If you want to be tested. Try USACO (http://ace.delos.com/usacogate/).
NrmMyth
22-03-2005, 05:58 PM
Originally posted by NrmMyth@Mar 20 2005, 10:24 PM
If you want to be tested. Try USACO (http://ace.delos.com/usacogate/).
Today the March competition has ended.
Final results will be at thursday.
NrmMyth
04-04-2005, 07:33 AM
IMO this topic should be cleaned of trash and pined. :ok:
By trash i mean all posts that aren't problems and their solutions.
Also it has to be nicely done!
Kon-Tiki
04-04-2005, 02:49 PM
What I see better, is to get together and set up some exams with different difficulty rating, along with possible solutions in pseudo-code for them, then pin it and lock it. These questions can then still be discussed in here.
NrmMyth
04-04-2005, 06:20 PM
Great, why not do this then, I'll help if I can. :ok:
Kon-Tiki
04-04-2005, 06:33 PM
Let's see if there're any others who want to join in too :ok:
NrmMyth
04-04-2005, 06:56 PM
So anyone who wants to join this noble cause can post here. :ok:
Unknown Hero
04-04-2005, 10:20 PM
Ahem, ahem. Maybe you forgot The Great Creator Of This Thread. LOL
I will join your cleaners team.
I hope you already noticed that those exams from the begining are the easiest. Also other four exams (other four that I posted) are one of the easiest. I think we can start there, and always add some difficultier.
Marek
07-04-2005, 06:45 AM
Double post, sorry...
Well here's the source...
You won't be able to compile it without the .Net Framework (obviously)
but you can still read through it...
the .cs files are the important ones and there is some sample data in an .xml file...
Kon-Tiki
07-04-2005, 09:37 PM
Make that language-independant questions that're based on basic syntax and commands. Nothing for algorithms and such yet, and it should be possible to solve it in any language, as it's nuts to make exams for every single supported language. We wouldn't see the forest through the trees anymore.
Marek
08-04-2005, 06:42 AM
Originally posted by NrmMyth@Apr 7 2005, 05:19 PM
So did you create it??? :w00t:
Here's the exe if you want it,
Including some screen shots in case you don't have, or don't want, the DotNet (http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3&displaylang=en) framework.
:ok:
Marek
13-04-2005, 07:28 AM
Here are my answers to the questions posted 12 April 2005...
Its C#, Hope I understood the questions correctly...
Ioncannon
30-04-2005, 11:31 PM
K I am gonna try at doing these exams. I am to lazy to put the exes on angelfire so I will right em here... (C++ btw)
1.
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int main()
{
* * *string enter;
* * *cout << "Enter a number\n=>";
* * *cin >> enter;
* * *cout << "\nYou entered:\n" << enter;
* * *cout << "\nPress any key to exit";
* * *getch();
* * *return 0;
}
I will do more later. I only looked over the code once, but I think it should compile...
Unknown Hero
03-05-2005, 03:18 PM
Originally posted by NrmMyth@Mar 5 2005, 06:05 PM
Take a look at this easy exam.
The input is the height of the piramide you have to print it.
height=4
* **
* * *
** * *
* * * *
You got the point.
Solved!!!
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
* *int n,i,j;
* *cin >> n;
* * * for (i=n-1; i>=0; i--)
* * * {
* * * * * j=0;
* * * * * while (j<i)
* * * * * {
* * * * * * * cout << " ";
* * * * * * * j++;
* * * * * }
* * * * * while (j<n)
* * * * * {
* * * * * * * * cout << "*";
* * * * * * * * cout << " ";
* * * * * * * * j++;
* * * * * }
* * * * * cout << endl; * * * * * * * *
* * * }
* *return 0;
}
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.