Skip to content

Commit 99d784d

Browse files
committed
added more questions
1 parent 6cdcc6b commit 99d784d

File tree

9 files changed

+82
-15
lines changed

9 files changed

+82
-15
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
[![Join the chat at https://gitter.im/rust-practise-questions/Lobby](https://badges.gitter.im/rust-practise-questions/Lobby.svg)](https://gitter.im/rust-practise-questions/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44
[![Build Status](https://travis-ci.com/sn99/rust-practise-questions.svg?branch=master)](https://travis-ci.com/sn99/rust-practise-questions)
55

6-
A set of questions for Rust lang **(yet to be completed)**
6+
A set of questions for Rust lang
77

88
Read [about](src/about.md) for more information about the book
99

1010
Read [CONTRIBUTING](CONTRIBUTING.md) for contributing to the book
1111

12-
[FAQs](FAQs.md)
12+
[FAQs](FAQs.md)
13+
14+
[![Visit Book](https://img.shields.io/badge/Book-Rendered-brightgreen.svg?style=for-the-badge)](https://sn99.github.io/rust-practise-questions/)
15+
16+
## Authors
17+
18+
* **Siddharth Naithani** - *Initial work* - [sn99](https://github.com/sn99)
19+
20+
See also the list of [contributors](https://github.com/sn99/rust-practise-questions/graphs/contributors) who participated in this project.
21+
22+
## License
23+
24+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

book.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ authors = [" Siddharth Naithani aka sn99"]
33
multilingual = false
44
src = "src"
55
title = "Jang"
6+
description = "Rust Practise Questions"
7+
8+
[output.html]
9+
google-analytics = "UA-138954958-1"

book/index.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8">
66
<title>About - Jang</title>
77
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
8-
<meta name="description" content="">
8+
<meta name="description" content="Rust Practise Questions">
99
<meta name="viewport" content="width=device-width, initial-scale=1">
1010
<meta name="theme-color" content="#ffffff" />
1111

@@ -170,6 +170,23 @@ <h1 class="menu-title">Jang</h1>
170170

171171

172172

173+
<!-- Google Analytics Tag -->
174+
<script type="text/javascript">
175+
var localAddrs = ["localhost", "127.0.0.1", ""];
176+
177+
// make sure we don't activate google analytics if the developer is
178+
// inspecting the book locally...
179+
if (localAddrs.indexOf(document.location.hostname) === -1) {
180+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
181+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
182+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
183+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
184+
185+
ga('create', 'UA-138954958-1', 'auto');
186+
ga('send', 'pageview');
187+
}
188+
</script>
189+
173190

174191

175192

book/print.html

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8">
66
<title>Jang</title>
77
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
8-
<meta name="description" content="">
8+
<meta name="description" content="Rust Practise Questions">
99
<meta name="viewport" content="width=device-width, initial-scale=1">
1010
<meta name="theme-color" content="#ffffff" />
1111

@@ -315,12 +315,18 @@ <h1 class="menu-title">Jang</h1>
315315
<p>Use pattern matching to find that whether a point lies on X-Axis, Y-Axis or on which quadrant.</p>
316316
</li>
317317
<li>
318-
<p>Create a struct that holds info about a gun(gun type, recoil time, magazine size, extra) where <code>gun type</code> and <code>extra</code> are enums and <code>extra</code> contains silencer, scope, extended mags nad <code>None</code>.<br />
318+
<p>Create a struct that holds info about a gun(gun type, recoil time, magazine size, extra) where <code>gun type</code> and
319+
<code>extra</code> are enums and <code>extra</code> contains silencer, scope, extended mags nad <code>None</code>.<br />
319320
Based on user input change the value of extra (may cause change in recoil time and magazine size).</p>
320321
</li>
321322
<li>
322323
<p>Create a Binary tree and have a method <code>add</code> on it to add elements to it and <code>min</code> and <code>max</code> to find the minimum and maximum element in it.</p>
323324
</li>
325+
<li>
326+
<p>Create a <code>Regex</code> to extract dates from this string <code>It was on 2019-03-14, almost after a year from 2018-02-11</code> and store in a
327+
Struct with fields of <code>day</code>, <code>month</code> and <code>year</code>.
328+
<code>hint:</code> Use <code>Regex</code> crate</p>
329+
</li>
324330
</ul>
325331
<a class="header" href="#chapter-5---traits--generics" id="chapter-5---traits--generics"><h1>Chapter 5 - Traits &amp; Generics</h1></a>
326332
<ul>
@@ -357,7 +363,12 @@ <h1 class="menu-title">Jang</h1>
357363
<p>Write a generic function name <code>Multiply</code> that multiplies all <code>usize</code>, <code>isize</code> and <code>fsize</code> type values.</p>
358364
</li>
359365
<li>
360-
<p>Make a generic function to return the greater of the 2 given values</p>
366+
<p>Make a generic function to return the greater of the 2 given values (integer and floats).</p>
367+
</li>
368+
<li>
369+
<p>Implement a trait named <code>Hello</code> with a default function <code>say(&amp;self)</code> that prints <code>Hello, &lt;self&gt;!</code>
370+
, Implement this for <code>str</code> and <code>string</code> without providing any definition of <code>Hello</code> (simply <code>impl Hello for str {}</code>)
371+
call <code>say</code> on str <code>World</code>.</p>
361372
</li>
362373
</ul>
363374
<ul>
@@ -369,7 +380,6 @@ <h1 class="menu-title">Jang</h1>
369380
<p>Create a struct name <code>ComplexNumber</code> that has 2 variables <code>re</code> &amp; <code>im</code> and overload <code>minus</code>
370381
and <code>plus</code> operator to add and subtract complex number.</p>
371382
</li>
372-
<li></li>
373383
</ul>
374384
<ul>
375385
<li>Implement a macro named <code>addition</code> to add any amount of numbers. <code>Eg</code>: <code>addition!(5, 6, 57 ,56, 1)</code>
@@ -409,6 +419,23 @@ <h1 class="menu-title">Jang</h1>
409419

410420

411421

422+
<!-- Google Analytics Tag -->
423+
<script type="text/javascript">
424+
var localAddrs = ["localhost", "127.0.0.1", ""];
425+
426+
// make sure we don't activate google analytics if the developer is
427+
// inspecting the book locally...
428+
if (localAddrs.indexOf(document.location.hostname) === -1) {
429+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
430+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
431+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
432+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
433+
434+
ga('create', 'UA-138954958-1', 'auto');
435+
ga('send', 'pageview');
436+
}
437+
</script>
438+
412439

413440

414441

book/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

book/searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/chapter_4-enum&patterns/questions.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
* Use pattern matching to find that whether a point lies on X-Axis, Y-Axis or on which quadrant.
1919

20-
* Create a struct that holds info about a gun(gun type, recoil time, magazine size, extra) where `gun type` and `extra` are enums and `extra` contains silencer, scope, extended mags nad `None`.\
20+
* Create a struct that holds info about a gun(gun type, recoil time, magazine size, extra) where `gun type` and
21+
`extra` are enums and `extra` contains silencer, scope, extended mags nad `None`.\
2122
Based on user input change the value of extra (may cause change in recoil time and magazine size).
2223

23-
* Create a Binary tree and have a method `add` on it to add elements to it and `min` and `max` to find the minimum and maximum element in it.
24+
* Create a Binary tree and have a method `add` on it to add elements to it and `min` and `max` to find the minimum and maximum element in it.
25+
26+
* Create a `Regex` to extract dates from this string `It was on 2019-03-14, almost after a year from 2018-02-11` and store in a
27+
Struct with fields of `day`, `month` and `year`.
28+
`hint:` Use `Regex` crate

src/chapter_5-traits&generics/questions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ next 11 numbers in geometric progression.\
2424

2525
* Write a generic function name `Multiply` that multiplies all `usize`, `isize` and `fsize` type values.
2626

27-
* Make a generic function to return the greater of the 2 given values
27+
* Make a generic function to return the greater of the 2 given values (integer and floats).
28+
29+
* Implement a trait named `Hello` with a default function `say(&self)` that prints `Hello, <self>!`
30+
, Implement this for `str` and `string` without providing any definition of `Hello` (simply `impl Hello for str {}`)
31+
call `say` on str `World`.

src/chapter_6-operatoroverloading/questions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
operator so that when 2 structs subtract it removes the chars of 2nd from 1st one.
33

44
* Create a struct name `ComplexNumber` that has 2 variables `re` & `im` and overload `minus`
5-
and `plus` operator to add and subtract complex number.
6-
7-
*
5+
and `plus` operator to add and subtract complex number.

0 commit comments

Comments
 (0)